diff --git a/.idea/.idea.Motherload/.idea/workspace.xml b/.idea/.idea.Motherload/.idea/workspace.xml
index 537d389..d4b6ed4 100644
--- a/.idea/.idea.Motherload/.idea/workspace.xml
+++ b/.idea/.idea.Motherload/.idea/workspace.xml
@@ -10,24 +10,45 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
@@ -79,7 +100,118 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -108,7 +240,7 @@
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "CppClangTidyOptionsId",
+ "settings.editor.selected.configurable": "editor.preferences.fonts.default",
"vue.rearranger.settings.migration": "true"
},
"keyToStringList": {
@@ -203,6 +335,13 @@
+
+
+
+
+
+
+
diff --git a/Engine/Engine.vcxproj b/Engine/Engine.vcxproj
index da19f05..2e06298 100644
--- a/Engine/Engine.vcxproj
+++ b/Engine/Engine.vcxproj
@@ -34,6 +34,7 @@
+
@@ -58,6 +59,7 @@
+
diff --git a/Engine/Text.cpp b/Engine/Text.cpp
new file mode 100644
index 0000000..68f99f5
--- /dev/null
+++ b/Engine/Text.cpp
@@ -0,0 +1,17 @@
+#include "Text.h"
+
+#include
+Text::Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color): m_Text(text), m_FontPath(fontPath), m_Color(color) {
+ m_Texture = new Texture(text, fontPath, size, color);
+ m_IsCreatedOk = m_Texture->IsCreationOk();
+ if(!m_IsCreatedOk) {
+ std::cout << "Error creating text texture, Text: " << text << std::endl;
+ }
+}
+Text::~Text() {
+ if(m_IsCreatedOk && m_Texture->IsCreationOk()) {
+ }
+}
+void Text::Draw(const Point2f& pos) const {
+ m_Texture->Draw(pos);
+}
diff --git a/Engine/Text.h b/Engine/Text.h
new file mode 100644
index 0000000..b924bce
--- /dev/null
+++ b/Engine/Text.h
@@ -0,0 +1,24 @@
+#pragma once
+#include
+
+#include "Texture.h"
+#include "../Game/TextureManager.h"
+
+class Text
+{
+public:
+ Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color);
+ Text() = default;
+ ~Text();
+
+ void Draw(const Point2f& pos) const;
+
+
+
+private:
+ std::string m_Text;
+ std::string m_FontPath;
+ Color4f m_Color;
+ Texture* m_Texture;
+ bool m_IsCreatedOk{ false };
+};
diff --git a/Game/Animations/Animation.cpp b/Game/Animations/Animation.cpp
index c5c6dd3..9d5503c 100644
--- a/Game/Animations/Animation.cpp
+++ b/Game/Animations/Animation.cpp
@@ -1,3 +1,4 @@
+#include "pch.h"
#include "Animation.h"
Animation::Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect): m_pTexture(pTexture), m_SrcRect(srcRect), m_Frames(frames) {
diff --git a/Game/Game.cpp b/Game/Game.cpp
index 0290c97..586c300 100644
--- a/Game/Game.cpp
+++ b/Game/Game.cpp
@@ -1,4 +1,3 @@
-#include
#include "pch.h"
#include "Game.h"
@@ -6,13 +5,14 @@
#include "colors.h"
#include "utils.h"
-#include "WorldLevel.h"
+#include "Levels/World/WorldLevel.h"
Rectf Game::VIEWPORT {};
Game::Game(const Window& window)
- : BaseGame { window }, m_Camera(Camera()), m_WorldLevel(WorldLevel(&m_Camera, GetViewPort())) {
+ : BaseGame { window }, m_Camera(Camera()), m_WorldLevel(WorldLevel(&m_Camera, GetViewPort())),
+ m_MainMenuLevel(MainMenuLevel(&m_Camera)), m_pCurrentLevel(&m_WorldLevel) {
Initialize();
Game::VIEWPORT = GetViewPort(); //TODO: See if this can be removed
}
@@ -39,13 +39,13 @@ void Game::Update(float elapsedSec) {
m_MouseOffset = m_Camera.GetPosition();
}
- m_WorldLevel.Update(elapsedSec);
+ m_pCurrentLevel->Update(elapsedSec);
}
void Game::Draw() const {
utils::ClearBackground(Color4f(0.0f, 0.0f, 0.3f, 1.0f));
- m_WorldLevel.Draw();
+ m_pCurrentLevel->Draw();
}
void Game::ProcessKeyDownEvent(const SDL_KeyboardEvent& e) {
@@ -57,7 +57,7 @@ void Game::ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
m_MousePos = Point2f { float(e.x), float(e.y) };
- m_WorldLevel.MouseMove(Point2f { float(e.x), float(e.y) });
+ m_pCurrentLevel->MouseMove(Point2f { float(e.x), float(e.y) });
}
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
@@ -82,5 +82,5 @@ void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
//}
}
void Game::ProcessImGui() {
- m_WorldLevel.ProcessImGui();
+ m_pCurrentLevel->ProcessImGui();
}
diff --git a/Game/Game.h b/Game/Game.h
index c1e15e7..6084581 100644
--- a/Game/Game.h
+++ b/Game/Game.h
@@ -2,7 +2,8 @@
#include "BaseGame.h"
#include "Camera.h"
-#include "WorldLevel.h"
+#include "Levels/MainMenu/MainMenuLevel.h"
+#include "Levels/World/WorldLevel.h"
class Game : public BaseGame
{
@@ -37,6 +38,9 @@ private:
Camera m_Camera;
WorldLevel m_WorldLevel;
+ MainMenuLevel m_MainMenuLevel;
+
+ Level* m_pCurrentLevel;
Point2f m_MousePos {};
Point2f m_MouseOffset {};
diff --git a/Game/Game.vcxproj b/Game/Game.vcxproj
index e7c7d7d..dc05a82 100644
--- a/Game/Game.vcxproj
+++ b/Game/Game.vcxproj
@@ -1,486 +1,488 @@
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 16.0
- Win32Proj
- {0f40114e-3e0c-4195-b425-91fd5ef586ad}
- Game
- 10.0
-
-
-
- Application
- true
- v143
- Unicode
-
-
- Application
- false
- v143
- true
- Unicode
-
-
- Application
- true
- v143
- Unicode
-
-
- Application
- false
- v143
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(SolutionDir)\Libraries\SDLTtf\SDL2_ttf-2.20.2\include;$(SolutionDir)\Libraries\SDLMixer\SDL2_mixer-2.6.3\include;$(SolutionDir)\Libraries\SDLImage\SDL2_image-2.6.3\include;$(SolutionDir)\Libraries\SDLMain\SDL2-2.26.3\include;$(SolutionDir)\Engine;$(IncludePath)
- $(SolutionDir)\x64\Debug;$(SolutionDir)\Libraries\SDLTtf\SDL2_ttf-2.20.2\lib\x64;$(SolutionDir)\Libraries\SDLMixer\SDL2_mixer-2.6.3\lib\x64;$(SolutionDir)\Libraries\SDLImage\SDL2_image-2.6.3\lib\x64;$(SolutionDir)\Libraries\SDLMain\SDL2-2.26.3\lib\x64;$(LibraryPath)
- BuildCompile
-
-
-
- Level3
- true
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
-
-
-
-
- Level3
- true
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
- true
- true
-
-
-
-
- Level3
- true
- _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
- NotUsing
- pch.h
-
-
- Console
- true
- Engine.lib;%(AdditionalDependencies)
-
-
-
-
- Copying dll files to executable
-
-
- xcopy "$(SolutionDir)Libraries\SDLMain\SDL2-2.26.3\lib\x64\*.dll" "$(TargetDir)" /y /d
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {0f40114e-3e0c-4195-b425-91fd5ef586ad}
+ Game
+ 10.0
+
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Game;C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(SolutionDir)\Libraries\SDLTtf\SDL2_ttf-2.20.2\include;$(SolutionDir)\Libraries\SDLMixer\SDL2_mixer-2.6.3\include;$(SolutionDir)\Libraries\SDLImage\SDL2_image-2.6.3\include;$(SolutionDir)\Libraries\SDLMain\SDL2-2.26.3\include;$(SolutionDir)\Engine;$(IncludePath)
+ $(SolutionDir)\x64\Debug;$(SolutionDir)\Libraries\SDLTtf\SDL2_ttf-2.20.2\lib\x64;$(SolutionDir)\Libraries\SDLMixer\SDL2_mixer-2.6.3\lib\x64;$(SolutionDir)\Libraries\SDLImage\SDL2_image-2.6.3\lib\x64;$(SolutionDir)\Libraries\SDLMain\SDL2-2.26.3\lib\x64;$(LibraryPath)
+ BuildCompile
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Console
+ true
+ Engine.lib;%(AdditionalDependencies)
+
+
+
+
+ Copying dll files to executable
+
+
+ xcopy "$(SolutionDir)Libraries\SDLMain\SDL2-2.26.3\lib\x64\*.dll" "$(TargetDir)" /y /d
xcopy "$(SolutionDir)Libraries\SDLImage\SDL2_image-2.6.3\lib\x64\*.dll" "$(TargetDir)" /y /d
xcopy "$(SolutionDir)Libraries\SDLMixer\SDL2_mixer-2.6.3\lib\x64\*.dll" "$(TargetDir)" /y /d
xcopy "$(SolutionDir)Libraries\SDLTtf\SDL2_ttf-2.20.2\lib\x64\*.dll" "$(TargetDir)" /y /d
xcopy "$(SolutionDir)Resources\*.*" "$(TargetDir)" /y /d /s
-
-
-
-
- Level3
- true
- true
- true
- NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
-
-
- Console
- true
- true
- true
-
-
-
-
-
-
-
-
- MultiThreadedDebugDll
- EnableFastChecks
- Disabled
- true
- NoListing
- x64\Debug\
- false
- false
- x64\Debug\
- Default
- true
- Column
- false
- Prompt
- false
- Sync
- false
- false
- false
- NotSet
- Precise
- true
- false
- false
- false
- Default
- false
- false
- Default
- Default
- false
- x64\Debug\
- x64\Debug\
- false
- Neither
- false
- x64\Debug\
- Cdecl
- x64\Debug\vc143.pdb
- NotUsing
- pch.h
- x64\Debug\Game.pch
- false
- false
- false
- true
- false
- false
- x64\Debug\
- true
- true
- false
- false
- Default
- x64\Debug\Game.tlog\
- false
- true
- false
- true
- true
- Level3
- x64\Debug\
- EditAndContinue
- false
- false
- false
- InheritWarningLevel
- true
- false
- _DEBUG;_CONSOLE;_UNICODE;UNICODE;
- true
- true
-
-
- MultiThreadedDebugDll
- EnableFastChecks
- Disabled
- true
- NoListing
- x64\Debug\
- false
- false
- x64\Debug\
- Default
- true
- Column
- false
- Prompt
- false
- Sync
- false
- false
- false
- NotSet
- Precise
- true
- false
- false
- false
- Default
- false
- false
- Default
- Default
- false
- x64\Debug\
- x64\Debug\
- false
- Neither
- false
- x64\Debug\
- Cdecl
- x64\Debug\vc143.pdb
- NotUsing
- pch.h
- x64\Debug\Game.pch
- false
- false
- false
- true
- false
- false
- x64\Debug\
- true
- true
- false
- false
- Default
- x64\Debug\Game.tlog\
- false
- true
- false
- true
- true
- Level3
- x64\Debug\
- EditAndContinue
- false
- false
- false
- InheritWarningLevel
- true
- false
- _DEBUG;_CONSOLE;_UNICODE;UNICODE;
- true
- true
-
-
-
-
-
-
- MultiThreadedDebugDll
- EnableFastChecks
- Disabled
- true
- NoListing
- x64\Debug\
- false
- false
- x64\Debug\
- Default
- true
- Column
- false
- Prompt
- false
- Sync
- false
- false
- false
- NotSet
- Precise
- true
- false
- false
- false
- Default
- false
- false
- Default
- Default
- false
- x64\Debug\
- x64\Debug\
- false
- Neither
- false
- x64\Debug\
- Cdecl
- x64\Debug\vc143.pdb
- Create
- pch.h
- x64\Debug\Game.pch
- false
- false
- false
- true
- false
- false
- x64\Debug\
- true
- true
- false
- false
- Default
- x64\Debug\Game.tlog\
- false
- true
- false
- true
- true
- Level3
- x64\Debug\
- EditAndContinue
- false
- false
- false
- InheritWarningLevel
- true
- false
- _DEBUG;_CONSOLE;_UNICODE;UNICODE;
- true
- true
-
-
-
-
-
-
- MultiThreadedDebugDll
- EnableFastChecks
- Disabled
- true
- NoListing
- x64\Debug\
- false
- false
- x64\Debug\
- Default
- true
- Column
- false
- Prompt
- false
- Sync
- false
- false
- false
- NotSet
- Precise
- true
- false
- false
- false
- Default
- false
- false
- Default
- Default
- false
- x64\Debug\
- x64\Debug\
- false
- Neither
- false
- x64\Debug\
- Cdecl
- x64\Debug\vc143.pdb
- Create
- pch.h
- x64\Debug\Game.pch
- false
- false
- false
- true
- false
- false
- x64\Debug\
- true
- true
- false
- false
- Default
- x64\Debug\Game.tlog\
- false
- true
- false
- true
- true
- Level3
- x64\Debug\
- EditAndContinue
- false
- false
- false
- InheritWarningLevel
- true
- false
- _DEBUG;_CONSOLE;_UNICODE;UNICODE;
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(TargetDir)
-
-
- C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(VC_IncludePath);$(WindowsSDK_IncludePath);
-
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ false
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ NotUsing
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ false
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ NotUsing
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
+
+
+
+
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ false
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ Create
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
+
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ false
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ Create
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(TargetDir)
+
+
+ C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Game;C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(VC_IncludePath);$(WindowsSDK_IncludePath);
+
\ No newline at end of file
diff --git a/Game/Game.vcxproj.filters b/Game/Game.vcxproj.filters
index c21ce55..abf3bfd 100644
--- a/Game/Game.vcxproj.filters
+++ b/Game/Game.vcxproj.filters
@@ -27,21 +27,42 @@
Source Files
-
- Source Files
-
Source Files
-
- Source Files
-
Source Files
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
@@ -53,20 +74,41 @@
Header Files
-
- Header Files
-
Header Files
-
- Header Files
-
Header Files
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
\ No newline at end of file
diff --git a/Game/GameManager.cpp b/Game/GameManager.cpp
index 8faed90..a41cc3b 100644
--- a/Game/GameManager.cpp
+++ b/Game/GameManager.cpp
@@ -1 +1,2 @@
+#include "pch.h"
#include "GameManager.h"
diff --git a/Game/GridSystem/WorldGridManager.cpp b/Game/GridSystem/WorldGridManager.cpp
index d6e3559..ba209ca 100644
--- a/Game/GridSystem/WorldGridManager.cpp
+++ b/Game/GridSystem/WorldGridManager.cpp
@@ -1,4 +1,5 @@
-#include "WorldGridManager.h"
+#include "pch.h"
+#include "WorldGridManager.h"
#include
@@ -15,31 +16,27 @@ WorldGridManager::WorldGridManager() {
WorldGridManager::~WorldGridManager() {
}
-std::vector WorldGridManager::GetSurroundingTiles(const WorldTile* world_tile) {
- std::vector tiles;
+surroundingTiles WorldGridManager::GetSurroundingTiles(const WorldTile* world_tile) {
+ surroundingTiles tiles;
Point2f pos = world_tile->GetPosition();
Point2f gridCoords = this->GetIndexFromPosition(pos);
int x = gridCoords.x;
//TODO: Stupid fix, fix this
int y = gridCoords.y - 1;
- if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) {
- return tiles;
- }
- for (int i { -1 }; i <= 1; ++i) {
- for (int j { -1 }; j <= 1; ++j) {
- if (i == 0 && j == 0) {
- continue;
- }
- if(x + i < 0 || x + i >= WORLD_WIDTH || y + j < 0 || y + j >= WORLD_HEIGHT) {
- continue;
- }
- WorldTile* tile = GetTileAtIndex(x + i, y + j);
- if (tile != nullptr) {
- tiles.push_back(tile);
- }
- }
- }
+
+ tiles.SetTile(TileDirection::TopLeft, this->GetTileAtIndex(x - 1, y - 1));
+ tiles.SetTile(TileDirection::TopMiddle, this->GetTileAtIndex(x, y - 1));
+ tiles.SetTile(TileDirection::TopRight, this->GetTileAtIndex(x + 1, y - 1));
+
+ tiles.SetTile(TileDirection::MiddleLeft, this->GetTileAtIndex(x - 1, y));
+ tiles.SetTile(TileDirection::MiddleRight, this->GetTileAtIndex(x + 1, y));
+
+ tiles.SetTile(TileDirection::BottomLeft, this->GetTileAtIndex(x - 1, y + 1));
+ tiles.SetTile(TileDirection::BottomMiddle, this->GetTileAtIndex(x, y + 1));
+ tiles.SetTile(TileDirection::BottomRight, this->GetTileAtIndex(x + 1, y + 1));
+
return tiles;
+
}
Point2f WorldGridManager::GetIndexFromPosition(Point2f position) {
int x = int(position.x / TILE_WIDTH + WORLD_WIDTH / 2);
diff --git a/Game/GridSystem/WorldGridManager.h b/Game/GridSystem/WorldGridManager.h
index 1b69b3a..bf21329 100644
--- a/Game/GridSystem/WorldGridManager.h
+++ b/Game/GridSystem/WorldGridManager.h
@@ -1,5 +1,6 @@
#pragma once
#include
+#include