Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Linked-List-Snake/Linked-List-Snake.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,16 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="source\Level\LevelController.cpp" />
<ClCompile Include="source\Level\LevelData.cpp" />
<ClCompile Include="source\Level\LevelModel.cpp" />
<ClCompile Include="source\Level\LevelNumber.cpp" />
<ClCompile Include="source\Level\LevelService.cpp" />
<ClCompile Include="source\Level\LevelView.cpp" />
<ClCompile Include="source\Time\TimeService.cpp" />
<ClCompile Include="source\UI\Credits\CreditsScreenUIController.cpp" />
<ClCompile Include="source\UI\Instructions\InstructionsScreenUIController.cpp" />
<ClCompile Include="source\UI\LevelSelectionScreen\LevelSelectionUIController.cpp" />
<ClCompile Include="source\UI\UIElement\AnimatedImageView.cpp" />
<ClCompile Include="source\UI\UIElement\ButtonView.cpp" />
<ClCompile Include="source\Global\Config.cpp" />
Expand All @@ -154,9 +161,16 @@
<ClCompile Include="source\UI\UIElement\UIView.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Level\LevelController.h" />
<ClInclude Include="include\Level\LevelData.h" />
<ClInclude Include="include\Level\LevelModel.h" />
<ClInclude Include="include\Level\LevelNumber.h" />
<ClInclude Include="include\Level\LevelService.h" />
<ClInclude Include="include\Level\LevelView.h" />
<ClInclude Include="include\Time\TimeService.h" />
<ClInclude Include="include\UI\Credits\CreditsScreenUIController.h" />
<ClInclude Include="include\UI\Instructions\InstructionsScreenUIController.h" />
<ClInclude Include="include\UI\LevelSelectionScreen\LevelSelectionUIController.h" />
<ClInclude Include="include\UI\UIElement\AnimatedImageView.h" />
<ClInclude Include="include\UI\UIElement\ButtonView.h" />
<ClInclude Include="include\Global\Config.h" />
Expand Down
54 changes: 54 additions & 0 deletions Linked-List-Snake/Linked-List-Snake.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,33 @@
<ClCompile Include="source\UI\Instructions\InstructionsScreenUIController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Time\TimeService.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\UI\UIElement\RectangleShapeView.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelNumber.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelService.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Level\LevelView.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\UI\LevelSelectionScreen\LevelSelectionUIController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Main\GameService.h">
Expand Down Expand Up @@ -119,5 +146,32 @@
<ClInclude Include="include\UI\Instructions\InstructionsScreenUIController.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Time\TimeService.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\UI\UIElement\RectangleShapeView.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelController.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelModel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelNumber.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelService.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Level\LevelView.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\UI\LevelSelectionScreen\LevelSelectionUIController.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions Linked-List-Snake/include/Global/ServiceLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "UI/UIService.h"
#include "Sound/SoundService.h"
#include "Time/TimeService.h"
#include "Level/LevelService.h"

namespace Global
{
Expand All @@ -15,6 +16,7 @@ namespace Global
Sound::SoundService* sound_service;
UI::UIService* ui_service;
Time::TimeService* time_service;
Level::LevelService* level_service;

ServiceLocator();
~ServiceLocator();
Expand All @@ -34,6 +36,7 @@ namespace Global
Sound::SoundService* getSoundService();
UI::UIService* getUIService();
Time::TimeService* getTimeService();
Level::LevelService* getLevelService();
void deleteServiceLocator();
};
}
23 changes: 23 additions & 0 deletions Linked-List-Snake/include/Level/LevelController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include "../../include/Level/LevelModel.h"

namespace Level {
//class LevelModel;
class LevelView;
class LevelController {
private:
LevelModel* level_model;
LevelView* level_view;
public:
LevelController();
~LevelController();


void initialize();
void update();
void render();

float getCellWidth();
float getCellHeight();
};
}
16 changes: 16 additions & 0 deletions Linked-List-Snake/include/Level/LevelData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
#include "../../include/Level/LevelService.h"
#include "../../include/Level/LevelNumber.h"

namespace Level
{
struct LevelData
{
LevelData(LevelNumber ind)
{
level_index = ind;
}

LevelNumber level_index;
};
}
23 changes: 23 additions & 0 deletions Linked-List-Snake/include/Level/LevelModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../include/Level/LevelData.h"
#include <vector>

namespace Level {
class LevelModel {
private:
std::vector<LevelData> level_configuration;

float cell_width;
float cell_height;
public:
static const int number_of_rows = 28;
static const int number_of_colums = 50;

LevelModel();
~LevelModel();
void initialize(int width, int height);
float getCellWidth();
float getCellHeight();
};
}
9 changes: 9 additions & 0 deletions Linked-List-Snake/include/Level/LevelNumber.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

namespace Level
{
enum class LevelNumber {
ONE,
TWO
};
}
25 changes: 25 additions & 0 deletions Linked-List-Snake/include/Level/LevelService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
#include "../../include/Level/LevelNumber.h"


namespace Level {
class LevelController;
class LevelService {
private:
LevelController* level_controller;
LevelNumber current_level;

void createLevelController();
void destroy();

public:
LevelService();
~LevelService();

void initialize();
void update();
void render();

void createLevel(LevelNumber level_to_load);
};
}
42 changes: 42 additions & 0 deletions Linked-List-Snake/include/Level/LevelView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../include/Global/ServiceLocator.h"
#include "../../include/UI/UIElement/RectangleShapeView.h"

namespace Level {
class RectangleShapeView;
class LevelView {
private:
const sf::Color background_color = sf::Color(180, 200, 160);
sf::Color border_color = sf::Color::Black;

UI::UIElement::RectangleShapeView* background_rectangle;
UI::UIElement::RectangleShapeView* border_rectangle;

float grid_width;
float grid_height;

void createViews();
void initializeBackground();
void initializeBorder();
void calculateGridExtents();
void destroy();


//RectangleShapeView* border_rectangle;
public:
static const int border_thickness = 10;
static const int border_offset_left = 40;
static const int border_offset_top = 40;

LevelView();
~LevelView();

void initialize();
void update();
void render();

float getGridWidth();
float getGridHeight();
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "UI/Interface/IUIController.h"
#include "UI//UIElement/ButtonView.h"
#include "UI//UIElement/ImageView.h"

namespace UI {
namespace LevelSelection {
class LevelSelectionUIController : public Interface::IUIController
{
private:
const float button_width = 400.f;
const float button_height = 140.f;

const float level_one_button_y_position = 500.f;
const float level_two_button_y_position = 700.f;
const float menu_button_y_position = 900.f;

const float background_alpha = 85.f;

UIElement::ImageView* background_image;
UIElement::ButtonView* level_one_button;
UIElement::ButtonView* level_two_button;
UIElement::ButtonView* menu_button;

void createImage();
void createButtons();
void initializeBackgroundImage();
void initializeButtons();
void calculateLeftOffsetForButton();
void registerButtonCallback();

void singleLinkedListButtonCallback();
void doubleLinkedListButtonCallback();
void menuButtonCallback();

void destroy();

public:
LevelSelectionUIController();
~LevelSelectionUIController();
void initialize() override;
void update() override;
void render() override;
void show() override;
};
}

}
2 changes: 2 additions & 0 deletions Linked-List-Snake/include/UI/UIService.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Instructions/InstructionsScreenUIController.h"
#include "UI/Credits/CreditsScreenUIController.h"
#include "UI/Interface/IUIController.h"
#include "UI/LevelSelectionScreen/LevelSelectionUIController.h"

namespace UI
{
Expand All @@ -14,6 +15,7 @@ namespace UI
MainMenu::MainMenuUIController* main_menu_controller;
Instructions::InstructionsScreenUIController* instructions_screen_ui_controller;
Credits::CreditsScreenUIController* credits_screen_ui_controller;
LevelSelection::LevelSelectionUIController* level_selection_ui_controller;


void createControllers();
Expand Down
2 changes: 1 addition & 1 deletion Linked-List-Snake/sfml/include/SFML/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
////////////////////////////////////////////////////////////
#define SFML_VERSION_MAJOR 2
#define SFML_VERSION_MINOR 6
#define SFML_VERSION_PATCH 0
#define SFML_VERSION_PATCH 2


////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion Linked-List-Snake/sfml/include/SFML/Graphics/Glyph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SFML_GRAPHICS_API Glyph
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
Glyph() : advance(0) {}
Glyph() : advance(0), lsbDelta(0), rsbDelta(0) {}

////////////////////////////////////////////////////////////
// Member data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ class SFML_GRAPHICS_API RenderTexture : public RenderTarget
/// Before calling this function, the render-texture is in
/// an invalid state, thus it is mandatory to call it before
/// doing anything with the render-texture.
///
/// The last parameter, \a depthBuffer, is useful if you want
/// to use the render-texture for 3D OpenGL rendering that requires
/// a depth buffer. Otherwise it is unnecessary, and you should
/// leave this parameter to false (which is its default value).
///
/// After creation, the contents of the render-texture are undefined.
/// Call `RenderTexture::clear` first to ensure a single color fill.
///
/// \param width Width of the render-texture
/// \param height Height of the render-texture
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
Expand All @@ -94,11 +98,15 @@ class SFML_GRAPHICS_API RenderTexture : public RenderTarget
/// Before calling this function, the render-texture is in
/// an invalid state, thus it is mandatory to call it before
/// doing anything with the render-texture.
///
/// The last parameter, \a settings, is useful if you want to enable
/// multi-sampling or use the render-texture for OpenGL rendering that
/// requires a depth or stencil buffer. Otherwise it is unnecessary, and
/// you should leave this parameter at its default value.
///
/// After creation, the contents of the render-texture are undefined.
/// Call `RenderTexture::clear` first to ensure a single color fill.
///
/// \param width Width of the render-texture
/// \param height Height of the render-texture
/// \param settings Additional settings for the underlying OpenGL texture and context
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-audio.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-main-d.pdb
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-main-s.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-network.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-system.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Linked-List-Snake/sfml/lib/Debug/sfml-window.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Linked-List-Snake/sfml/lib/cmake/SFML/SFMLConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ if (NOT SFML_FOUND)
endif()

if (SFML_FOUND AND NOT SFML_FIND_QUIETLY)
message(STATUS "Found SFML 2.6.0 in ${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "Found SFML 2.6.2 in ${CMAKE_CURRENT_LIST_DIR}")
endif()
Loading