Reformat + Basic animation system

General fixes
This commit is contained in:
Bram Verhulst
2024-04-01 10:27:37 +02:00
parent 3b9c96ea8d
commit 0f9bb76973
28 changed files with 918 additions and 546 deletions

1
.idea/.idea.Motherload/.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
Motherload

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AnalysisUIOptions">
<option name="SCOPE_TYPE" value="4" />
</component>
<component name="AutoGeneratedRunConfigurationManager">
<projectFile>Game/Game.vcxproj</projectFile>
</component>
@@ -9,16 +12,33 @@
<component name="ChangeListManager">
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/.name" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Engine/utils.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/utils.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/indexLayout.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/projectSettingsUpdater.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Player/PlayerWalk.aseprite" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Game/Animations/Animation.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Game/Animations/Animation.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/copilot/chatSessions/blobs/version" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/PlayerWalk.aseprite" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Camera.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Camera.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Camera.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Camera.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Level.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Level.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Level.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Level.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Player.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Player.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/TextureManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/TextureManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldGridManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldGridManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/TextureManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/TextureManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldGridManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldGridManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldLevel.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldTile.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldTile.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Prog2Engine.sln" beforeDir="false" afterPath="$PROJECT_DIR$/Motherload.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldLevel.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/main.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/pch.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/pch.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -62,6 +82,10 @@
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 1
@@ -76,11 +100,13 @@
&quot;C++ Project.Game.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;CppClangTidyOptionsId&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
&quot;keyToStringList&quot;: {
@@ -156,14 +182,39 @@
<workItem from="1711641119746" duration="813000" />
<workItem from="1711642495862" duration="258000" />
<workItem from="1711647566340" duration="378000" />
<workItem from="1711647993177" duration="357000" />
<workItem from="1711647993177" duration="454000" />
<workItem from="1711694346681" duration="157000" />
<workItem from="1711694523256" duration="228000" />
<workItem from="1711694778634" duration="924000" />
<workItem from="1711697604502" duration="2696000" />
<workItem from="1711706270506" duration="2205000" />
<workItem from="1711718669225" duration="530000" />
<workItem from="1711734864498" duration="5607000" />
<workItem from="1711819496854" duration="481000" />
<workItem from="1711959076645" duration="941000" />
</task>
<task id="LOCAL-00001" summary="Rework Tile detection system">
<option name="closed" value="true" />
<created>1711648418492</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1711648418492</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Rework Tile detection system" />
<option name="LAST_COMMIT_MESSAGE" value="Rework Tile detection system" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

View File

@@ -0,0 +1,25 @@
#include "Animation.h"
Animation::Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect): m_pTexture(pTexture), m_SrcRect(srcRect), m_Frames(frames) {
}
Animation::~Animation() {
}
void Animation::Update(float elapsedSec) {
if (m_isPlaying) {
m_FrameTimer -= elapsedSec;
if (m_FrameTimer <= 0.0f) {
m_FrameTimer = 0.1f;
++m_CurrentFrame;
if (m_CurrentFrame >= m_Frames) {
m_CurrentFrame = 0;
}
}
}
}
void Animation::Draw(const Point2f& pos, float angle) const {
Rectf src = m_SrcRect;
src.left += m_CurrentFrame * src.width;
auto dst = Rectf { pos.x, pos.y, src.width, src.height };
m_pTexture->Draw(dst, src, m_isFlipped);
}

View File

@@ -0,0 +1,30 @@
#pragma once
#include "Texture.h"
class Animation
{
public:
Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect);
~Animation();
void Update(float elapsedSec);
void Draw(const Point2f& pos, float angle = 0.0f) const;
void SetPlaying(bool isPlaying) {
m_isPlaying = isPlaying;
}
void SetFlipped(bool isFlipped) {
m_isFlipped = isFlipped;
}
private:
Texture* m_pTexture;
Rectf m_SrcRect;
int m_Frames { 0 };
int m_CurrentFrame { 0 };
float m_FrameTimer { 0.0f };
bool m_isPlaying { true };
bool m_isFlipped { false };
};

View File

@@ -14,14 +14,14 @@ void Camera::BeginRendering() const {
glScalef(m_Scale, m_Scale, 1);
}
// ReSharper disable once CppMemberFunctionMayBeStatic
void Camera::EndRendering() const {
glPopMatrix();
}
Point2f Camera::TransformMouse(const Point2f& mousePos) const {
//Mousepos is in screen coords, we need to transform it to world coords
Point2f worldPos = mousePos;
worldPos.x = (worldPos.x + m_Position.x) / m_Scale;
worldPos.x = ( worldPos.x + m_Position.x ) / m_Scale;
worldPos.y = Viewport.height - worldPos.y + m_Position.y / m_Scale;
return worldPos;
}

View File

@@ -5,28 +5,42 @@ class Player;
class Camera
{
public:
Camera( );
Camera( const Point2f& position, float scale = 1);
Camera();
Camera(const Point2f& position, float scale = 1);
~Camera() = default;
void SetPosition( const Point2f& position ) { m_Position = position; }
void SetScale( const float scale ) { m_Scale = scale; }
Camera(const Camera& other) = default;
Camera& operator=(const Camera& other) = default;
const Point2f& GetPosition( ) const { return m_Position; }
float GetScale( ) const { return m_Scale; }
void SetPosition(const Point2f& position) {
m_Position = position;
}
void SetScale(const float scale) {
m_Scale = scale;
}
const Point2f& GetPosition() const {
return m_Position;
}
float GetScale() const {
return m_Scale;
}
void BeginRendering() const;
void EndRendering() const;
void SetTrackingPlayer(Player* player) { m_FollowingPlayer = player; }
void SetTrackingPlayer(Player* player) {
m_FollowingPlayer = player;
}
Point2f TransformMouse (const Point2f& mousePos) const;
Point2f TransformWorld (const Point2f& worldPos) const;
Rectf Viewport = Rectf{ 0, 0, 846.f, 500.f };
Point2f TransformMouse(const Point2f& mousePos) const;
Point2f TransformWorld(const Point2f& worldPos) const;
Rectf Viewport = Rectf { 0, 0, 846.f, 500.f };
//TODO: Remove this and make it some static
private:
Point2f m_Position;
float m_Scale;
Player* m_FollowingPlayer{ nullptr };
Player* m_FollowingPlayer { nullptr };
//TODO: Ask if the rule applies to the fact that the player is not managed by the camera
};

View File

@@ -2,7 +2,6 @@
#include "pch.h"
#include "Game.h"
#include <iostream>
#include <ostream>
#include "colors.h"
@@ -10,11 +9,10 @@
#include "WorldLevel.h"
Rectf Game::VIEWPORT{};
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())) {
Initialize();
Game::VIEWPORT = GetViewPort(); //TODO: See if this can be removed
}
@@ -24,7 +22,7 @@ Game::~Game() {
}
void Game::Initialize() {
m_Camera.SetPosition(Point2f{-GetViewPort().width / 2, -GetViewPort().height / 2});
m_Camera.SetPosition(Point2f { -GetViewPort().width / 2, -GetViewPort().height / 2 });
}
void Game::Cleanup() {
@@ -33,10 +31,11 @@ void Game::Cleanup() {
void Game::Update(float elapsedSec) {
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
if(m_IsRightMouseDown) {
Point2f newCameraPos = Point2f{m_MousePos.x + m_MouseOffset.x, m_MousePos.y + m_MouseOffset.y};
m_Camera.SetPosition(Point2f{-newCameraPos.x, -newCameraPos.y});
} else {
if (m_IsRightMouseDown) {
const Point2f newCameraPos = Point2f { m_MousePos.x + m_MouseOffset.x, m_MousePos.y + m_MouseOffset.y };
m_Camera.SetPosition(Point2f { -newCameraPos.x, -newCameraPos.y });
}
else {
m_MouseOffset = m_Camera.GetPosition();
}
@@ -57,13 +56,13 @@ void Game::ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
}
void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
m_MousePos = Point2f{float(e.x), float(e.y)};
m_MousePos = Point2f { float(e.x), float(e.y) };
m_WorldLevel.MouseMove(Point2f { float(e.x), float(e.y) });
}
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT;
m_MouseOffset = Point2f{-m_Camera.GetPosition().x - m_MousePos.x, -m_Camera.GetPosition().y - m_MousePos.y};
m_MouseOffset = Point2f { -m_Camera.GetPosition().x - m_MousePos.x, -m_Camera.GetPosition().y - m_MousePos.y };
}
void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {

View File

@@ -1,10 +1,8 @@
#pragma once
#include <vector>
#include "BaseGame.h"
#include "Camera.h"
#include "WorldLevel.h"
#include "WorldTile.h"
class Game : public BaseGame
{
@@ -15,7 +13,7 @@ public:
Game(Game&& other) = delete;
Game& operator=(Game&& other) = delete;
// http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-override
~Game();
~Game() override;
void Update(float elapsedSec) override;
void Draw() const override;
@@ -40,8 +38,8 @@ private:
Camera m_Camera;
WorldLevel m_WorldLevel;
Point2f m_MousePos{};
Point2f m_MouseOffset{};
bool m_IsRightMouseDown{};
Point2f m_MousePos {};
Point2f m_MouseOffset {};
bool m_IsRightMouseDown {};
};

View File

@@ -1,327 +1,476 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{0f40114e-3e0c-4195-b425-91fd5ef586ad}</ProjectGuid>
<RootNamespace>Game</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>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)</IncludePath>
<LibraryPath>$(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)</LibraryPath>
<CustomBuildAfterTargets>BuildCompile</CustomBuildAfterTargets>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Engine.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<CustomBuildStep>
<Command>
</Command>
<Message>Copying dll files to executable</Message>
</CustomBuildStep>
<PostBuildEvent>
<Command>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</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Camera.cpp" />
<ClCompile Include="Game.cpp" />
<ClCompile Include="WorldGridManager.cpp" />
<ClCompile Include="Level.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
<ClCompile Include="main.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="Player.cpp" />
<ClCompile Include="TextureManager.cpp" />
<ClCompile Include="WorldLevel.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
<ClCompile Include="WorldTile.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Camera.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="WorldGridManager.h" />
<ClInclude Include="Level.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Player.h" />
<ClInclude Include="TextureManager.h" />
<ClInclude Include="WorldLevel.h" />
<ClInclude Include="WorldTile.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<PropertyGroup>
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{0f40114e-3e0c-4195-b425-91fd5ef586ad}</ProjectGuid>
<RootNamespace>Game</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform"/>
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform"/>
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform"/>
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform"/>
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>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)</IncludePath>
<LibraryPath>$(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)</LibraryPath>
<CustomBuildAfterTargets>BuildCompile</CustomBuildAfterTargets>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Engine.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<CustomBuildStep>
<Command>
</Command>
<Message>Copying dll files to executable</Message>
</CustomBuildStep>
<PostBuildEvent>
<Command>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
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Animations\Animation.cpp"/>
<ClCompile Include="Camera.cpp"/>
<ClCompile Include="Game.cpp"/>
<ClCompile Include="GridSystem\WorldGridManager.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
<ClCompile Include="GridSystem\WorldTile.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
<ClCompile Include="Level.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
<ClCompile Include="main.cpp"/>
<ClCompile Include="pch.cpp"/>
<ClCompile Include="Player.cpp"/>
<ClCompile Include="TextureManager.cpp"/>
<ClCompile Include="WorldLevel.cpp">
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>true</SupportJustMyCode>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>x64\Debug\</AssemblerListingLocation>
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
<BrowseInformation>false</BrowseInformation>
<BrowseInformationFile>x64\Debug\</BrowseInformationFile>
<CompileAs>Default</CompileAs>
<ConformanceMode>true</ConformanceMode>
<DiagnosticsFormat>Column</DiagnosticsFormat>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<ErrorReporting>Prompt</ErrorReporting>
<ExpandAttributedSource>false</ExpandAttributedSource>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableASAN>false</EnableASAN>
<EnableFuzzer>false</EnableFuzzer>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<GenerateModuleDependencies>false</GenerateModuleDependencies>
<GenerateSourceDependencies>false</GenerateSourceDependencies>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<LanguageStandard>Default</LanguageStandard>
<LanguageStandard_C>Default</LanguageStandard_C>
<MinimalRebuild>false</MinimalRebuild>
<ModuleDependenciesFile>x64\Debug\</ModuleDependenciesFile>
<ModuleOutputFile>x64\Debug\</ModuleOutputFile>
<OmitDefaultLibName>false</OmitDefaultLibName>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ObjectFileName>x64\Debug\</ObjectFileName>
<CallingConvention>Cdecl</CallingConvention>
<ProgramDataBaseFileName>x64\Debug\vc143.pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>x64\Debug\Game.pch</PrecompiledHeaderOutputFile>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessKeepComments>false</PreprocessKeepComments>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
<ShowIncludes>false</ShowIncludes>
<SourceDependenciesFile>x64\Debug\</SourceDependenciesFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BufferSecurityCheck>true</BufferSecurityCheck>
<SmallerTypeCheck>false</SmallerTypeCheck>
<SpectreMitigation>false</SpectreMitigation>
<StructMemberAlignment>Default</StructMemberAlignment>
<TrackerLogDirectory>x64\Debug\Game.tlog\</TrackerLogDirectory>
<TranslateIncludes>false</TranslateIncludes>
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
<TreatWarningAsError>false</TreatWarningAsError>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<UseFullPaths>true</UseFullPaths>
<WarningLevel>Level3</WarningLevel>
<XMLDocumentationFileName>x64\Debug\</XMLDocumentationFileName>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<IntelJCCErratum>false</IntelJCCErratum>
<BuildStlModules>false</BuildStlModules>
<TreatAngleIncludeAsExternal>false</TreatAngleIncludeAsExternal>
<ExternalWarningLevel>InheritWarningLevel</ExternalWarningLevel>
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
<DisableAnalyzeExternal>false</DisableAnalyzeExternal>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_UNICODE;UNICODE;</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<LinkCompiled>true</LinkCompiled>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Animations\Animation.h"/>
<ClInclude Include="Camera.h"/>
<ClInclude Include="Game.h"/>
<ClInclude Include="GridSystem\WorldGridManager.h"/>
<ClInclude Include="GridSystem\WorldTile.h"/>
<ClInclude Include="Level.h"/>
<ClInclude Include="pch.h"/>
<ClInclude Include="Player.h"/>
<ClInclude Include="TextureManager.h"/>
<ClInclude Include="WorldLevel.h"/>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<PropertyGroup>
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>C:\Users\Bram\Desktop\Programming 2\Exam\dae16-VerhulstBram\Engine\imgui;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
</Project>

View File

@@ -1,22 +1,22 @@
#include "WorldGridManager.h"
WorldGridManager::WorldGridManager() {
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
for(size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
m_worldTiles[x][y] = nullptr;
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
m_worldTiles[x][y] = nullptr;
}
}
}
WorldGridManager::~WorldGridManager() {
}
WorldTile* WorldGridManager::GetTileAtIndex(const int x, const int y) const {
WorldTile * WorldGridManager::GetTileAtIndex(const int x, const int y) const {
if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) {
return nullptr;
}
return m_worldTiles[x][y];
}
WorldTile* WorldGridManager::GetTileAtWorldPos(const Point2f& pos) const {
WorldTile * WorldGridManager::GetTileAtWorldPos(const Point2f& pos) const {
int x = int(pos.x / TILE_WIDTH + WORLD_WIDTH / 2);
int y = int(-pos.y / TILE_HEIGHT);
if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) {

View File

@@ -1,6 +1,5 @@
#pragma once
#include <array>
#include <vector>
#include "structs.h"
@@ -12,15 +11,16 @@ static const int TILE_HEIGHT = 50;
class WorldTile;
struct surroundingTiles {
std::array<WorldTile*, 8> tiles;
struct surroundingTiles
{
std::array<WorldTile *, 8> tiles;
//Center of the surrounding tiles is 0, 0
void SetTile(int x, int y, WorldTile* tile) {
tiles[x + y * 3] = tile;
}
WorldTile* GetTile(int x, int y) {
WorldTile * GetTile(int x, int y) {
return tiles[x + y * 3];
}
};
@@ -30,15 +30,16 @@ class WorldGridManager
public:
WorldGridManager();
~WorldGridManager();
WorldTile* GetTileAtIndex(const int x, const int y) const;
WorldTile* GetTileAtWorldPos(const Point2f& pos) const;
WorldGridManager(const WorldGridManager& other) = default;
WorldTile * GetTileAtIndex(const int x, const int y) const;
WorldTile * GetTileAtWorldPos(const Point2f& pos) const;
void SetTileAtIndex(const int x, const int y, WorldTile* tile);
private:
std::array<std::array<WorldTile *, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;
std::array<std::array<WorldTile*, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;
};

View File

@@ -1,8 +1,7 @@
#include "pch.h"
#include "WorldTile.h"
#include "WorldTile.h"
#include "colors.h"
#include "TextureManager.h"
#include "../TextureManager.h"
#include "utils.h"
@@ -17,12 +16,12 @@ WorldTile::~WorldTile() {
void WorldTile::Draw() const {
if (*m_GroundTileType != Tiles::AIR) {
m_pTexture->Draw(m_Position);
if(m_Hightlight) {
if (m_Hightlight) {
utils::SetColor(Colors::GREEN);
utils::FillRect(m_Position, 50, 50);
}
}
}
Collision::TileCollisionRect WorldTile::GetCollisionRect() {
return Collision::TileCollisionRect{ m_Position, GetSize(), (this)};
return Collision::TileCollisionRect { m_Position, GetSize(), ( this ) };
}

View File

@@ -1,7 +1,7 @@
#pragma once
#include "Collision.h"
#include "Texture.h"
#include "TextureManager.h"
#include "../TextureManager.h"
@@ -13,21 +13,23 @@ enum class GroundTileTypes
Iron
};
class GroundTileType {
class GroundTileType
{
public:
GroundTileType(const std::string& filePath, GroundTileTypes type): m_filePath(filePath), m_type(type) {}
GroundTileType(const std::string& filePath, GroundTileTypes type): m_filePath(filePath), m_type(type) {
}
virtual ~GroundTileType() = default;
bool operator== ( const GroundTileType& rhs ) const {
bool operator==(const GroundTileType& rhs) const {
return m_type == rhs.m_type;
}
bool operator!= ( const GroundTileType& rhs) const {
bool operator!=(const GroundTileType& rhs) const {
return m_type != rhs.m_type;
}
virtual bool operator== (const GroundTileType* rhs) const {
virtual bool operator==(const GroundTileType* rhs) const {
return rhs->m_type == m_type;
}
virtual bool operator!= (const GroundTileType* rhs) const {
virtual bool operator!=(const GroundTileType* rhs) const {
return rhs->m_type != m_type;
}
@@ -38,73 +40,87 @@ public:
virtual GroundTileTypes getType() const {
return m_type;
}
protected:
std::string m_filePath;
private:
GroundTileTypes m_type;
};
class RandomGroundTile: public GroundTileType {
class RandomGroundTile : public GroundTileType
{
public:
RandomGroundTile(const std::string& filePath, GroundTileTypes type, int maxRandom): GroundTileType(filePath, type), m_maxRandom(maxRandom) {
}
~RandomGroundTile() override = default;
bool operator== (const GroundTileType* rhs) const override{
bool operator==(const GroundTileType* rhs) const override {
return rhs->getType() == this->getType();
}
bool operator!= (const GroundTileType* rhs) const override{
bool operator!=(const GroundTileType* rhs) const override {
return rhs->getType() != this->getType();
}
}
std::string getPath() const override {
int variant = utils::randRange(1, m_maxRandom);
std::string toReplace{ "[0]" };
std::string toReplace { "[0]" };
std::string replacement = std::to_string(utils::randRange(1, m_maxRandom));
size_t found = m_filePath.find(toReplace);
std::string newFilePath{ m_filePath };
if(found != std::string::npos) {
std::string newFilePath { m_filePath };
if (found != std::string::npos) {
newFilePath.replace(found, 3, replacement);
}
return newFilePath;
}
}
private:
int m_maxRandom;
};
namespace Tiles
{
static GroundTileType* AIR = new GroundTileType("", GroundTileTypes::Air);
static GroundTileType* AIR = new GroundTileType("", GroundTileTypes::Air);
static GroundTileType* DIRT = new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5);
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
}
class WorldTile {
class WorldTile
{
public:
WorldTile() = default;
WorldTile(const Point2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager);
~WorldTile();
void Draw() const;
Point2f GetPosition() const { return m_Position; }
void SetPosition(const Point2f& position) { m_Position = position; }
Point2f GetPosition() const {
return m_Position;
}
void SetPosition(const Point2f& position) {
m_Position = position;
}
Point2f GetSize() const { return Point2f{ 50, 50 }; }
Point2f GetSize() const {
return Point2f { 50, 50 };
}
GroundTileType* GetTileType() const { return m_GroundTileType; }
void SetTileType(GroundTileType* type) { m_GroundTileType = type; }
GroundTileType * GetTileType() const {
return m_GroundTileType;
}
void SetTileType(GroundTileType* type) {
m_GroundTileType = type;
}
Collision::TileCollisionRect GetCollisionRect();
bool m_Hightlight{ false };
bool m_Hightlight { false };
private:
Point2f m_Position;
GroundTileType* m_GroundTileType;
@@ -113,6 +129,6 @@ private:
Collision::CollisionRect m_CollisionRect;
};

View File

@@ -9,4 +9,4 @@ Level::Level(Camera* camera) {
m_pCamera = camera;
}
Level::~Level() {
}
}

View File

@@ -6,8 +6,11 @@ class Level
public:
Level();
Level(Camera* camera);
virtual ~Level();
virtual ~Level();
Level(const Level& other) = default;
Level(Level&& other) = default;
virtual void Update(float elapsedSec) = 0;
virtual void Draw() const = 0;
virtual void MouseMove(const Point2f& mousePos) = 0;

View File

@@ -6,21 +6,34 @@
#include "colors.h"
#include "utils.h"
#include "WorldLevel.h"
#include "Animations/Animation.h"
Player::Player(const Point2f& Position) : m_Position(Position), m_Size(Point2f{40, 40}), m_Vel(Point2f{0,0}), m_Acc(Point2f{0,0}) {
Player::Player(const Point2f& Position, TextureManager* manager) : m_Position(Position), m_Size(Point2f { 40, 40 }), m_Vel(Point2f { 0, 0 }), m_Acc(Point2f { 0, 0 }) {
m_ContactMap[Collision::CollisionDirection::Top] = nullptr;
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
m_ContactMap[Collision::CollisionDirection::Right] = nullptr;
m_walkAnimation = new Animation(manager->GetTexture("animations/player/player_walk.png"), 8, 0.1f, Rectf { 0, 0, 70, 70 });
}
Collision::CollisionRect Player::GetCollisionRect() {
Collision::CollisionRect rect = {m_Position, m_Size, m_Vel};
Collision::CollisionRect Player::GetCollisionRect() const {
Collision::CollisionRect rect = { m_Position, m_Size, m_Vel };
return rect;
}
void Player::Draw() const {
utils::SetColor(Colors::PINK);
utils::DrawRect(Rectf{m_Position.x, m_Position.y, m_Size.x, m_Size.y});
if (m_DrawCollisionRect) {
utils::SetColor(Colors::PINK);
utils::DrawRect(Rectf { m_Position.x, m_Position.y, m_Size.x, m_Size.y });
}
Point2f center = m_Position + m_Size / 2;
const int frameWidth = 70; //TODO: fix this
int halfFrameWidth = frameWidth / 2;
auto drawPos = Point2f { center.x - halfFrameWidth - 10, center.y - halfFrameWidth + 9 };
m_walkAnimation->Draw(drawPos, 0);
}
void Player::ProcessImGui() {
ImGui::Begin("Collision Info", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
@@ -28,6 +41,7 @@ void Player::ProcessImGui() {
ImGui::Text("Did just dig right: %s", m_DidJustDigRight ? "true" : "false");
bool test = !utils::isKeyDown(SDL_SCANCODE_H);
ImGui::Text("Is Key Up H: %s", test ? "true" : "false");
ImGui::Checkbox("Draw Collision Rect", &m_DrawCollisionRect);
//ContactMap
ImGui::Text("ContactMap:");
@@ -39,112 +53,109 @@ void Player::ProcessImGui() {
}
void Player::Update(float elapsedTime, WorldLevel& level) {
// m_Acc.y += m_Gravity.y;
// m_Vel.y = std::min(m_Vel.y, m_MaxSpeed);
//
// Point2f nextPos = m_Position + m_Vel * elapsedTime;
// //collision checking
m_Vel = Point2f{0, -100};
m_Vel = Point2f { 0, -100 };
//check for keys
if(utils::isKeyDown(SDL_SCANCODE_W)) {
if (utils::isKeyDown(SDL_SCANCODE_W)) {
m_Vel.y = 100;
m_Grounded = false;
}
if(utils::isKeyPressed(SDL_SCANCODE_S)) {
if (utils::isKeyPressed(SDL_SCANCODE_S)) {
m_Vel.y = -100;
if(m_Grounded) {
if(m_ContactMap[Collision::CollisionDirection::Bottom] != nullptr) {
if (m_Grounded) {
if (m_ContactMap[Collision::CollisionDirection::Bottom] != nullptr) {
m_ContactMap[Collision::CollisionDirection::Bottom]->SetTileType(Tiles::AIR);
WorldTile* tile = m_ContactMap[Collision::CollisionDirection::Bottom];
//center of tile
Point2f tileCenter = tile->GetCollisionRect().getCollisionRect().pos + tile->GetCollisionRect().getCollisionRect().size / 2;
m_Position = Point2f{tileCenter.x - m_Size.x / 2, tileCenter.y - m_Size.y / 2 + 5};
m_Position = Point2f { tileCenter.x - m_Size.x / 2, tileCenter.y - m_Size.y / 2 + 5 };
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
}
}
}
if(utils::isKeyDown(SDL_SCANCODE_A)) {
if (utils::isKeyDown(SDL_SCANCODE_A)) {
m_walkAnimation->SetFlipped(false);
m_Vel.x = -100;
}
if(utils::isKeyDown(SDL_SCANCODE_D)) {
if (utils::isKeyDown(SDL_SCANCODE_D)) {
m_Vel.x = 100;
if(m_Grounded && !m_DidJustDigRight) {
m_walkAnimation->SetFlipped(true);
if (m_Grounded && !m_DidJustDigRight) {
//Check if the player doesnt come from digging a tile
if(m_ContactMap[Collision::CollisionDirection::Right] != nullptr) {
if (m_ContactMap[Collision::CollisionDirection::Right] != nullptr) {
m_ContactMap[Collision::CollisionDirection::Right]->SetTileType(Tiles::AIR);
WorldTile* tile = m_ContactMap[Collision::CollisionDirection::Right];
//center of tile
Point2f tileCenter = tile->GetCollisionRect().getCollisionRect().pos + tile->GetCollisionRect().getCollisionRect().size / 2;
m_Position = Point2f{tileCenter.x - m_Size.x / 2, tileCenter.y - m_Size.y / 2 + 5};
const Point2f tileCenter = tile->GetCollisionRect().getCollisionRect().pos + tile->GetCollisionRect().getCollisionRect().size / 2;
m_Position = Point2f { tileCenter.x - m_Size.x / 2, tileCenter.y - m_Size.y / 2 + 5 };
m_ContactMap[Collision::CollisionDirection::Right] = nullptr;
m_DidJustDigRight = true;
}
}
}
if(m_DidJustDigRight) {
if(!utils::isKeyDown(SDL_SCANCODE_D)) {
if (m_DidJustDigRight) {
if (!utils::isKeyDown(SDL_SCANCODE_D)) {
m_DidJustDigRight = false;
}
}
}
m_walkAnimation->Update(elapsedTime);
m_ContactMap[Collision::CollisionDirection::Top] = nullptr;
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
m_ContactMap[Collision::CollisionDirection::Right] = nullptr;
m_Grounded = false;
float t = 0, min_t = INFINITY;
Point2f intersectionPoint, normal;
std::vector<std::pair<int, float>> contactTimes{};
WorldGridManager& gridManager = level.GetGridManager();
std::vector<std::pair<int, float>> contactTimes {};
const WorldGridManager& gridManager = level.GetGridManager();
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
for(int y { 0 }; y < WORLD_HEIGHT; ++y) {
WorldTile* tile = gridManager.GetTileAtIndex(x,y);
if(*tile->GetTileType() != Tiles::AIR) {
for (int y { 0 }; y < WORLD_HEIGHT; ++y) {
WorldTile* tile = gridManager.GetTileAtIndex(x, y);
if (*tile->GetTileType() != Tiles::AIR) {
tile->m_Hightlight = false;
if(Collision::DynamicRectVsRect(this->GetCollisionRect(), elapsedTime, tile->GetCollisionRect().getCollisionRect(), intersectionPoint, normal, t)) {
contactTimes.push_back(std::pair<int, float>{x + y * WORLD_WIDTH, t});
if (Collision::DynamicRectVsRect(this->GetCollisionRect(), elapsedTime, tile->GetCollisionRect().getCollisionRect(), intersectionPoint, normal, t)) {
contactTimes.emplace_back(std::pair<int, float> { x + y * WORLD_WIDTH, t });
}
}
}
}
std::sort(contactTimes.begin(), contactTimes.end(), [](const std::pair<int, float>& a, const std::pair<int, float>& b) {
std::sort(contactTimes.begin(), contactTimes.end(), [](const std::pair<int, float>& a, const std::pair<int, float>& b)
{
return a.second < b.second;
});
for (std::pair<int, float> contact_time : contactTimes) {
int x = contact_time.first % WORLD_WIDTH;
int y = contact_time.first / WORLD_WIDTH;
WorldTile* world_tile = gridManager.GetTileAtIndex(x,y);
WorldTile* world_tile = gridManager.GetTileAtIndex(x, y);
const Point2f WorldTilePos = world_tile->GetCollisionRect().getCollisionRect().pos;
const Point2f WorldTileSize = world_tile->GetCollisionRect().getCollisionRect().size;
if(WorldTilePos.y + WorldTileSize.y > m_Position.y) {
if(WorldTilePos.x + WorldTileSize.x > m_Position.x) {
if(WorldTilePos.y + WorldTileSize.y / 2 > m_Position.y && m_Position.y + m_Size.y / 2 > WorldTilePos.y) {
if (WorldTilePos.y + WorldTileSize.y > m_Position.y) {
if (WorldTilePos.x + WorldTileSize.x > m_Position.x) {
if (WorldTilePos.y + WorldTileSize.y / 2 > m_Position.y && m_Position.y + m_Size.y / 2 > WorldTilePos.y) {
//Right of player
m_ContactMap[Collision::CollisionDirection::Right] = world_tile;
}
}
}
if(WorldTilePos.y + WorldTileSize.y > m_Position.y) {
if(WorldTilePos.x < m_Position.x + m_Size.x) {
if(WorldTilePos.y + WorldTileSize.y / 2 > m_Position.y && m_Position.y + m_Size.y / 2 > WorldTilePos.y) {
if (WorldTilePos.y + WorldTileSize.y > m_Position.y) {
if (WorldTilePos.x < m_Position.x + m_Size.x) {
if (WorldTilePos.y + WorldTileSize.y / 2 > m_Position.y && m_Position.y + m_Size.y / 2 > WorldTilePos.y) {
//Left of player
m_ContactMap[Collision::CollisionDirection::Left] = world_tile;
}
@@ -152,8 +163,8 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
}
//Below the player
if(WorldTilePos.y + WorldTileSize.y <= m_Position.y) {
if(WorldTilePos.x + WorldTileSize.x / 2 > m_Position.x && m_Position.x + m_Size.x / 2 > WorldTilePos.x) {
if (WorldTilePos.y + WorldTileSize.y <= m_Position.y) {
if (WorldTilePos.x + WorldTileSize.x / 2 > m_Position.x && m_Position.x + m_Size.x / 2 > WorldTilePos.x) {
m_ContactMap[Collision::CollisionDirection::Bottom] = world_tile;
m_Grounded = true;
world_tile->m_Hightlight = true;
@@ -164,6 +175,24 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
Collision::ResolvePlayerVsRect(*this, elapsedTime, &rect);
}
m_Position = m_Position + m_Vel * elapsedTime;
if (m_Vel.x != 0.0f) {
m_State = PlayerState::Walking;
}
else {
m_State = PlayerState::Idle;
}
switch (m_State) {
case PlayerState::Idle:
m_walkAnimation->SetPlaying(false);
break;
case PlayerState::Walking:
m_walkAnimation->SetPlaying(true);
break;
default:
break;
}
m_Position = m_Position + m_Vel * elapsedTime;
}

View File

@@ -1,24 +1,60 @@
#pragma once
#include "Collision.h"
#include "TextureManager.h"
#include "Animations/Animation.h"
class WorldLevel;
enum class PlayerState
{
Idle,
Walking,
Digging,
};
enum class PlayerDirection
{
Left,
Right,
Up,
Down,
};
enum class DigDirection
{
Left,
Right,
Down
};
class Player
{
public:
Player(const Point2f& Position);
Collision::CollisionRect GetCollisionRect();
Player(const Point2f& Position, TextureManager* pTextureManager);
Collision::CollisionRect GetCollisionRect() const;
void Update(float elapsedTime, WorldLevel& level);
void Draw() const;
void SetPosition(Point2f pos) { m_Position = pos; }
Point2f GetPosition() const { return m_Position; }
void SetVelocity(Point2f vel) { m_Vel = vel; }
Point2f GetVelocity() const { return m_Vel; }
void SetPosition(Point2f pos) {
m_Position = pos;
}
Point2f GetPosition() const {
return m_Position;
}
auto GetContactMap(){ return m_ContactMap; }
void SetContactMap(Collision::CollisionDirection dir, WorldTile* tile) { m_ContactMap[dir] = tile; }
void SetVelocity(Point2f vel) {
m_Vel = vel;
}
Point2f GetVelocity() const {
return m_Vel;
}
auto GetContactMap() {
return m_ContactMap;
}
void SetContactMap(Collision::CollisionDirection dir, WorldTile* tile) {
m_ContactMap[dir] = tile;
}
void ProcessImGui();
@@ -28,12 +64,20 @@ private:
Point2f m_Vel;
std::map<Collision::CollisionDirection, WorldTile*> m_ContactMap;
std::map<Collision::CollisionDirection, WorldTile *> m_ContactMap;
Point2f m_Acc;
Point2f m_Gravity{ 0, -9.81f };
Point2f m_Gravity { 0, -9.81f };
bool m_Grounded{ false };
bool m_Grounded { false };
bool m_DidJustDigRight{ false };
bool m_DidJustDigRight { false };
Animation* m_walkAnimation;
PlayerState m_State { PlayerState::Idle };
PlayerDirection m_Direction { PlayerDirection::Right };
DigDirection m_DigDirection { DigDirection::Right };
//Testing
bool m_DrawCollisionRect { true };
};

View File

@@ -1,18 +1,21 @@
#include "pch.h"
#include "TextureManager.h"
TextureManager* TextureManager::m_pInstance = NULL;
TextureManager* TextureManager::m_pInstance = nullptr;
TextureManager* TextureManager::GetInstance() {
TextureManager * TextureManager::GetInstance() {
if (m_pInstance == nullptr) {
m_pInstance = new TextureManager();
}
return m_pInstance;
}
Texture* TextureManager::GetTexture(const std::string& name) {
Texture * TextureManager::GetTexture(const std::string& name) {
if (m_Textures.find(name) != m_Textures.end()) {
return m_Textures[name];
}
Texture* pTexture = new Texture(name);
m_Textures[name] = pTexture;
return pTexture;
}
}
TextureManager::~TextureManager() {
//TODO: Loop over the m_Textures to delete them
}

View File

@@ -6,15 +6,15 @@
class TextureManager
{
public:
TextureManager() = default;
static TextureManager * GetInstance();
Texture * GetTexture(const std::string& name);
static TextureManager* GetInstance();
Texture* GetTexture(const std::string& name);
static TextureManager* m_pInstance;
private:
std::map<std::string, Texture*> m_Textures{};
};
TextureManager() = default;
~TextureManager();
static TextureManager* m_pInstance;
private:
std::map<std::string, Texture *> m_Textures {};
};

View File

@@ -11,20 +11,18 @@
#include "utils.h"
WorldLevel::WorldLevel(Camera* camera, Rectf viewport):
Level(camera),
m_gridManager(WorldGridManager()),
m_player(Player { Point2f { 0, 100 } }),
m_mousePos { 0, 0 },
m_viewport(viewport)
{
WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
m_gridManager(WorldGridManager()),
m_player(Player { Point2f { 0, 100 }, TextureManager::GetInstance() }),
m_mousePos { 0, 0 },
m_viewport(viewport) {
// The grid is 34 x 50 big, the top center is 0,0 in world coords
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
int actualX = x - WORLD_WIDTH / 2;
Point2f pos = Point2f{ float(actualX * TILE_WIDTH), -float(y * TILE_HEIGHT) - TILE_HEIGHT};
auto pos = Point2f { float(actualX * TILE_WIDTH), -float(y * TILE_HEIGHT) - TILE_HEIGHT };
GroundTileType* type = Tiles::AIR;
switch(utils::randRange(0,2)) {
switch (utils::randRange(0, 2)) {
case 0:
type = Tiles::DIRT;
break;
@@ -38,8 +36,7 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport):
std::cout << "??" << std::endl;
}
m_gridManager.SetTileAtIndex(x,y, new WorldTile{ pos, type, TextureManager::GetInstance() });
m_gridManager.SetTileAtIndex(x, y, new WorldTile { pos, type, TextureManager::GetInstance() });
}
}
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
@@ -48,27 +45,27 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport):
}
WorldLevel::~WorldLevel() {
//delete m_pTextTexture;
}
void WorldLevel::Update(float elapsedSec) {
int mouseX, mouseY;
SDL_GetMouseState(&mouseX, &mouseY);
m_mousePos = Point2f{ float(mouseX), float(mouseY) };
m_mousePos = Point2f { float(mouseX), float(mouseY) };
m_mousePos = m_pCamera->TransformMouse(m_mousePos);
//m_player.Update(elapsedSec, *this);
WorldTile* selectedTile{ nullptr };
WorldTile* selectedTile { nullptr };
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
if(m_gridManager.GetTileAtIndex(x,y)->GetCollisionRect().Contains(m_mousePos)) {
selectedTile = m_gridManager.GetTileAtIndex(x,y);
if (m_gridManager.GetTileAtIndex(x, y)->GetCollisionRect().Contains(m_mousePos)) {
selectedTile = m_gridManager.GetTileAtIndex(x, y);
}
}
}
if(selectedTile != nullptr) {
if(utils::isMouseDown(SDL_BUTTON_LEFT)) {
if (selectedTile != nullptr) {
if (utils::isMouseDown(SDL_BUTTON_LEFT)) {
selectedTile->SetTileType(Tiles::AIR);
}
}
@@ -76,7 +73,7 @@ void WorldLevel::Update(float elapsedSec) {
m_player.Update(elapsedSec, *this);
WorldTile* t = m_gridManager.GetTileAtWorldPos(m_mousePos);
if(t != nullptr) {
if (t != nullptr) {
t->SetTileType(Tiles::AIR);
}
@@ -100,15 +97,15 @@ void WorldLevel::Draw() const {
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
m_gridManager.GetTileAtIndex(x,y)->Draw();
m_gridManager.GetTileAtIndex(x, y)->Draw();
}
}
//loop over worldtiles
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
for (int y { 0 }; y < WORLD_HEIGHT; ++y) {
if(*m_gridManager.GetTileAtIndex(x,y)->GetTileType() != Tiles::AIR) {
Collision::CollisionRect rect = m_gridManager.GetTileAtIndex(x,y)->GetCollisionRect().getCollisionRect();
if (*m_gridManager.GetTileAtIndex(x, y)->GetTileType() != Tiles::AIR) {
Collision::CollisionRect rect = m_gridManager.GetTileAtIndex(x, y)->GetCollisionRect().getCollisionRect();
utils::SetColor(Colors::GREEN);
utils::DrawRect(rect.pos, rect.size.x, rect.size.y);
}
@@ -134,16 +131,17 @@ void WorldLevel::ProcessImGui() {
if (ImGui::MenuItem("Camera Info")) {
m_ShowCameraWindow = !m_ShowCameraWindow;
}
if(ImGui::MenuItem("Player Info")) {
if (ImGui::MenuItem("Player Info")) {
m_ShowPlayerInfo = !m_ShowPlayerInfo;
}
ImGui::EndMenu();
}
if(ImGui::BeginMenu(std::to_string(utils::isKeyPressed(SDL_SCANCODE_S)).c_str())){}
if (ImGui::BeginMenu(std::to_string(utils::isKeyPressed(SDL_SCANCODE_S)).c_str())) {
}
ImGui::EndMainMenuBar();
}
if(m_ShowTextureManagerWindow) {
if (m_ShowTextureManagerWindow) {
ImGui::Begin("Texture Manager", &m_ShowTextureManagerWindow, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("Texture loading Count:");
ImGui::SameLine();
@@ -151,17 +149,17 @@ void WorldLevel::ProcessImGui() {
ImGui::End();
}
if(m_ShowCameraWindow) {
if (m_ShowCameraWindow) {
ImGui::Begin("Camera", &m_ShowCameraWindow, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("Camera Position: (%f, %f)", m_pCamera->GetPosition().x, m_pCamera->GetPosition().y);
ImGui::Text("Camera Position: (%f, %f)", m_pCamera->GetPosition().x, m_pCamera->GetPosition().y);
ImGui::Text("Is Right Mouse Down: %s", utils::isMouseDown(0) ? "true" : "false");
if(ImGui::Button("Reset Camera")) {
m_pCamera->SetPosition(Point2f{-m_viewport.width / 2, -m_viewport.height / 2});
if (ImGui::Button("Reset Camera")) {
m_pCamera->SetPosition(Point2f { -m_viewport.width / 2, -m_viewport.height / 2 });
}
ImGui::End();
}
if(m_ShowPlayerInfo) {
if (m_ShowPlayerInfo) {
ImGui::Begin("Player Info", &m_ShowPlayerInfo, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("Player Position: (%f, %f)", m_player.GetPosition().x, m_player.GetPosition().y);
ImGui::Text("Player Velocity: (%f, %f)", m_player.GetVelocity().x, m_player.GetVelocity().y);

View File

@@ -1,43 +1,42 @@
#pragma once
#include "Level.h"
#include "Texture.h"
#include "WorldLevel.h"
#include "WorldTile.h"
#include <array>
#include "Collision.h"
#include "Level.h"
#include "Player.h"
#include "utils.h"
#include "WorldGridManager.h"
#include "WorldLevel.h"
#include "GridSystem/WorldGridManager.h"
class WorldLevel : public Level {
class WorldLevel : public Level
{
public:
WorldLevel(Camera* camera, Rectf viewport);
~WorldLevel() override;
WorldLevel(const WorldLevel& other) = default;
WorldLevel(WorldLevel&& other) = default;
void Update(float elapsedSec) override;
void Draw() const override;
void MouseMove(const Point2f& mousePos) override;
void ProcessImGui() override;
WorldGridManager& GetGridManager() { return m_gridManager; }
WorldGridManager& GetGridManager() {
return m_gridManager;
}
std::vector<Collision::CollisionRect> m_Rects;
private:
WorldGridManager m_gridManager{};
WorldGridManager m_gridManager {};
Player m_player;
Point2f m_mousePos{};
Point2f m_mousePos {};
Rectf m_viewport;
// ImGui Vars
bool m_ShowTextureManagerWindow{ false };
bool m_ShowCameraWindow{ false };
bool m_ShowPlayerInfo{ true };
bool m_ShowTextureManagerWindow { false };
bool m_ShowCameraWindow { false };
bool m_ShowPlayerInfo { true };
};

View File

@@ -6,13 +6,12 @@
void StartHeapControl();
void DumpMemoryLeaks();
int SDL_main(int argv, char** args)
{
int SDL_main(int argv, char** args) {
srand(static_cast<unsigned int>(time(nullptr)));
StartHeapControl();
Game* pGame { new Game { Window { "Motherload - Verhulst, Bram - 1DAEGD16E", 846.f, 500.f } } };
auto pGame { new Game { Window { "Motherload - Verhulst, Bram - 1DAEGD16E", 846.f, 500.f } } };
pGame->Run();
delete pGame;

View File

@@ -1 +1 @@
#include "pch.h"
#include "pch.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB