mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2026-02-04 09:29:20 +01:00
Reformat + Basic animation system
General fixes
This commit is contained in:
1
.idea/.idea.Motherload/.idea/.name
generated
Normal file
1
.idea/.idea.Motherload/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Motherload
|
||||||
Binary file not shown.
8
.idea/.idea.Motherload/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.Motherload/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.Motherload/.idea/projectSettingsUpdater.xml
generated
Normal file
6
.idea/.idea.Motherload/.idea/projectSettingsUpdater.xml
generated
Normal 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>
|
||||||
63
.idea/.idea.Motherload/.idea/workspace.xml
generated
63
.idea/.idea.Motherload/.idea/workspace.xml
generated
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="AnalysisUIOptions">
|
||||||
|
<option name="SCOPE_TYPE" value="4" />
|
||||||
|
</component>
|
||||||
<component name="AutoGeneratedRunConfigurationManager">
|
<component name="AutoGeneratedRunConfigurationManager">
|
||||||
<projectFile>Game/Game.vcxproj</projectFile>
|
<projectFile>Game/Game.vcxproj</projectFile>
|
||||||
</component>
|
</component>
|
||||||
@@ -9,16 +12,33 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="">
|
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/.name" afterDir="false" />
|
<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.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/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.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/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/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/WorldLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldLevel.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Game/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/WorldTile.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$/Prog2Engine.sln" beforeDir="false" afterPath="$PROJECT_DIR$/Motherload.sln" 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>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -62,6 +82,10 @@
|
|||||||
<component name="MarkdownSettingsMigration">
|
<component name="MarkdownSettingsMigration">
|
||||||
<option name="stateVersion" value="1" />
|
<option name="stateVersion" value="1" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
|
||||||
|
<component name="ProblemsViewState">
|
||||||
|
<option name="selectedTabId" value="CurrentFile" />
|
||||||
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"customColor": "",
|
"customColor": "",
|
||||||
"associatedIndex": 1
|
"associatedIndex": 1
|
||||||
@@ -76,11 +100,13 @@
|
|||||||
"C++ Project.Game.executor": "Run",
|
"C++ Project.Game.executor": "Run",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"settings.editor.selected.configurable": "CppClangTidyOptionsId",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
@@ -156,14 +182,39 @@
|
|||||||
<workItem from="1711641119746" duration="813000" />
|
<workItem from="1711641119746" duration="813000" />
|
||||||
<workItem from="1711642495862" duration="258000" />
|
<workItem from="1711642495862" duration="258000" />
|
||||||
<workItem from="1711647566340" duration="378000" />
|
<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>
|
||||||
|
<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 />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
<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>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
25
Game/Animations/Animation.cpp
Normal file
25
Game/Animations/Animation.cpp
Normal 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);
|
||||||
|
}
|
||||||
30
Game/Animations/Animation.h
Normal file
30
Game/Animations/Animation.h
Normal 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 };
|
||||||
|
};
|
||||||
@@ -14,12 +14,12 @@ void Camera::BeginRendering() const {
|
|||||||
glScalef(m_Scale, m_Scale, 1);
|
glScalef(m_Scale, m_Scale, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once CppMemberFunctionMayBeStatic
|
||||||
void Camera::EndRendering() const {
|
void Camera::EndRendering() const {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
Point2f Camera::TransformMouse(const Point2f& mousePos) const {
|
Point2f Camera::TransformMouse(const Point2f& mousePos) const {
|
||||||
//Mousepos is in screen coords, we need to transform it to world coords
|
|
||||||
Point2f worldPos = mousePos;
|
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;
|
worldPos.y = Viewport.height - worldPos.y + m_Position.y / m_Scale;
|
||||||
|
|||||||
@@ -9,16 +9,29 @@ public:
|
|||||||
Camera(const Point2f& position, float scale = 1);
|
Camera(const Point2f& position, float scale = 1);
|
||||||
~Camera() = default;
|
~Camera() = default;
|
||||||
|
|
||||||
void SetPosition( const Point2f& position ) { m_Position = position; }
|
Camera(const Camera& other) = default;
|
||||||
void SetScale( const float scale ) { m_Scale = scale; }
|
Camera& operator=(const Camera& other) = default;
|
||||||
|
|
||||||
const Point2f& GetPosition( ) const { return m_Position; }
|
void SetPosition(const Point2f& position) {
|
||||||
float GetScale( ) const { return m_Scale; }
|
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 BeginRendering() const;
|
||||||
void EndRendering() 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 TransformMouse(const Point2f& mousePos) const;
|
||||||
Point2f TransformWorld(const Point2f& worldPos) const;
|
Point2f TransformWorld(const Point2f& worldPos) const;
|
||||||
@@ -29,4 +42,5 @@ private:
|
|||||||
Point2f m_Position;
|
Point2f m_Position;
|
||||||
float m_Scale;
|
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
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
@@ -13,8 +12,7 @@
|
|||||||
Rectf Game::VIEWPORT {};
|
Rectf Game::VIEWPORT {};
|
||||||
|
|
||||||
Game::Game(const Window& window)
|
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();
|
Initialize();
|
||||||
Game::VIEWPORT = GetViewPort(); //TODO: See if this can be removed
|
Game::VIEWPORT = GetViewPort(); //TODO: See if this can be removed
|
||||||
}
|
}
|
||||||
@@ -34,9 +32,10 @@ void Game::Update(float elapsedSec) {
|
|||||||
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
|
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
|
||||||
|
|
||||||
if (m_IsRightMouseDown) {
|
if (m_IsRightMouseDown) {
|
||||||
Point2f newCameraPos = Point2f{m_MousePos.x + m_MouseOffset.x, m_MousePos.y + m_MouseOffset.y};
|
const Point2f newCameraPos = Point2f { m_MousePos.x + m_MouseOffset.x, m_MousePos.y + m_MouseOffset.y };
|
||||||
m_Camera.SetPosition(Point2f { -newCameraPos.x, -newCameraPos.y });
|
m_Camera.SetPosition(Point2f { -newCameraPos.x, -newCameraPos.y });
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_MouseOffset = m_Camera.GetPosition();
|
m_MouseOffset = m_Camera.GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "BaseGame.h"
|
#include "BaseGame.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "WorldLevel.h"
|
#include "WorldLevel.h"
|
||||||
#include "WorldTile.h"
|
|
||||||
|
|
||||||
class Game : public BaseGame
|
class Game : public BaseGame
|
||||||
{
|
{
|
||||||
@@ -15,7 +13,7 @@ public:
|
|||||||
Game(Game&& other) = delete;
|
Game(Game&& other) = delete;
|
||||||
Game& operator=(Game&& other) = delete;
|
Game& operator=(Game&& other) = delete;
|
||||||
// http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-override
|
// http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-override
|
||||||
~Game();
|
~Game() override;
|
||||||
|
|
||||||
void Update(float elapsedSec) override;
|
void Update(float elapsedSec) override;
|
||||||
void Draw() const override;
|
void Draw() const override;
|
||||||
|
|||||||
@@ -127,7 +127,8 @@
|
|||||||
xcopy "$(SolutionDir)Libraries\SDLImage\SDL2_image-2.6.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\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)Libraries\SDLTtf\SDL2_ttf-2.20.2\lib\x64\*.dll" "$(TargetDir)" /y /d
|
||||||
xcopy "$(SolutionDir)Resources\*.*" "$(TargetDir)" /y /d /s</Command>
|
xcopy "$(SolutionDir)Resources\*.*" "$(TargetDir)" /y /d /s
|
||||||
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -147,9 +148,157 @@ xcopy "$(SolutionDir)Resources\*.*" "$(TargetDir)" /y /d /s</Command>
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="Animations\Animation.cpp"/>
|
||||||
<ClCompile Include="Camera.cpp"/>
|
<ClCompile Include="Camera.cpp"/>
|
||||||
<ClCompile Include="Game.cpp"/>
|
<ClCompile Include="Game.cpp"/>
|
||||||
<ClCompile Include="WorldGridManager.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">
|
<ClCompile Include="Level.cpp">
|
||||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
@@ -302,18 +451,18 @@ xcopy "$(SolutionDir)Resources\*.*" "$(TargetDir)" /y /d /s</Command>
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<LinkCompiled>true</LinkCompiled>
|
<LinkCompiled>true</LinkCompiled>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="WorldTile.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Animations\Animation.h"/>
|
||||||
<ClInclude Include="Camera.h"/>
|
<ClInclude Include="Camera.h"/>
|
||||||
<ClInclude Include="Game.h"/>
|
<ClInclude Include="Game.h"/>
|
||||||
<ClInclude Include="WorldGridManager.h" />
|
<ClInclude Include="GridSystem\WorldGridManager.h"/>
|
||||||
|
<ClInclude Include="GridSystem\WorldTile.h"/>
|
||||||
<ClInclude Include="Level.h"/>
|
<ClInclude Include="Level.h"/>
|
||||||
<ClInclude Include="pch.h"/>
|
<ClInclude Include="pch.h"/>
|
||||||
<ClInclude Include="Player.h"/>
|
<ClInclude Include="Player.h"/>
|
||||||
<ClInclude Include="TextureManager.h"/>
|
<ClInclude Include="TextureManager.h"/>
|
||||||
<ClInclude Include="WorldLevel.h"/>
|
<ClInclude Include="WorldLevel.h"/>
|
||||||
<ClInclude Include="WorldTile.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
@@ -12,7 +11,8 @@ static const int TILE_HEIGHT = 50;
|
|||||||
|
|
||||||
class WorldTile;
|
class WorldTile;
|
||||||
|
|
||||||
struct surroundingTiles {
|
struct surroundingTiles
|
||||||
|
{
|
||||||
std::array<WorldTile *, 8> tiles;
|
std::array<WorldTile *, 8> tiles;
|
||||||
|
|
||||||
//Center of the surrounding tiles is 0, 0
|
//Center of the surrounding tiles is 0, 0
|
||||||
@@ -31,13 +31,14 @@ public:
|
|||||||
WorldGridManager();
|
WorldGridManager();
|
||||||
~WorldGridManager();
|
~WorldGridManager();
|
||||||
|
|
||||||
|
WorldGridManager(const WorldGridManager& other) = default;
|
||||||
|
|
||||||
WorldTile * GetTileAtIndex(const int x, const int y) const;
|
WorldTile * GetTileAtIndex(const int x, const int y) const;
|
||||||
WorldTile * GetTileAtWorldPos(const Point2f& pos) const;
|
WorldTile * GetTileAtWorldPos(const Point2f& pos) const;
|
||||||
|
|
||||||
void SetTileAtIndex(const int x, const int y, WorldTile* tile);
|
void SetTileAtIndex(const int x, const int y, WorldTile* tile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::array<std::array<WorldTile *, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;
|
std::array<std::array<WorldTile *, WORLD_WIDTH>, WORLD_HEIGHT> m_worldTiles;
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "WorldTile.h"
|
||||||
#include "WorldTile.h"
|
|
||||||
|
|
||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
#include "TextureManager.h"
|
#include "../TextureManager.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "TextureManager.h"
|
#include "../TextureManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +13,11 @@ enum class GroundTileTypes
|
|||||||
Iron
|
Iron
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroundTileType {
|
class GroundTileType
|
||||||
|
{
|
||||||
public:
|
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;
|
virtual ~GroundTileType() = default;
|
||||||
bool operator==(const GroundTileType& rhs) const {
|
bool operator==(const GroundTileType& rhs) const {
|
||||||
return m_type == rhs.m_type;
|
return m_type == rhs.m_type;
|
||||||
@@ -38,13 +40,16 @@ public:
|
|||||||
virtual GroundTileTypes getType() const {
|
virtual GroundTileTypes getType() const {
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_filePath;
|
std::string m_filePath;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GroundTileTypes m_type;
|
GroundTileTypes m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RandomGroundTile: public GroundTileType {
|
class RandomGroundTile : public GroundTileType
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
RandomGroundTile(const std::string& filePath, GroundTileTypes type, int maxRandom): GroundTileType(filePath, type), m_maxRandom(maxRandom) {
|
RandomGroundTile(const std::string& filePath, GroundTileTypes type, int maxRandom): GroundTileType(filePath, type), m_maxRandom(maxRandom) {
|
||||||
}
|
}
|
||||||
@@ -73,6 +78,7 @@ public:
|
|||||||
|
|
||||||
return newFilePath;
|
return newFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_maxRandom;
|
int m_maxRandom;
|
||||||
};
|
};
|
||||||
@@ -84,7 +90,8 @@ namespace Tiles
|
|||||||
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorldTile {
|
class WorldTile
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
WorldTile() = default;
|
WorldTile() = default;
|
||||||
WorldTile(const Point2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager);
|
WorldTile(const Point2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager);
|
||||||
@@ -92,19 +99,28 @@ public:
|
|||||||
|
|
||||||
void Draw() const;
|
void Draw() const;
|
||||||
|
|
||||||
Point2f GetPosition() const { return m_Position; }
|
Point2f GetPosition() const {
|
||||||
void SetPosition(const Point2f& position) { m_Position = position; }
|
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; }
|
GroundTileType * GetTileType() const {
|
||||||
void SetTileType(GroundTileType* type) { m_GroundTileType = type; }
|
return m_GroundTileType;
|
||||||
|
}
|
||||||
|
void SetTileType(GroundTileType* type) {
|
||||||
|
m_GroundTileType = type;
|
||||||
|
}
|
||||||
|
|
||||||
Collision::TileCollisionRect GetCollisionRect();
|
Collision::TileCollisionRect GetCollisionRect();
|
||||||
|
|
||||||
bool m_Hightlight { false };
|
bool m_Hightlight { false };
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Point2f m_Position;
|
Point2f m_Position;
|
||||||
GroundTileType* m_GroundTileType;
|
GroundTileType* m_GroundTileType;
|
||||||
@@ -8,6 +8,9 @@ public:
|
|||||||
Level(Camera* camera);
|
Level(Camera* camera);
|
||||||
virtual ~Level();
|
virtual ~Level();
|
||||||
|
|
||||||
|
Level(const Level& other) = default;
|
||||||
|
Level(Level&& other) = default;
|
||||||
|
|
||||||
virtual void Update(float elapsedSec) = 0;
|
virtual void Update(float elapsedSec) = 0;
|
||||||
virtual void Draw() const = 0;
|
virtual void Draw() const = 0;
|
||||||
virtual void MouseMove(const Point2f& mousePos) = 0;
|
virtual void MouseMove(const Point2f& mousePos) = 0;
|
||||||
|
|||||||
@@ -6,28 +6,42 @@
|
|||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "WorldLevel.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::Top] = nullptr;
|
||||||
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
|
||||||
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
|
||||||
m_ContactMap[Collision::CollisionDirection::Right] = 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 Player::GetCollisionRect() const {
|
||||||
Collision::CollisionRect rect = { m_Position, m_Size, m_Vel };
|
Collision::CollisionRect rect = { m_Position, m_Size, m_Vel };
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Draw() const {
|
void Player::Draw() const {
|
||||||
|
if (m_DrawCollisionRect) {
|
||||||
utils::SetColor(Colors::PINK);
|
utils::SetColor(Colors::PINK);
|
||||||
utils::DrawRect(Rectf { m_Position.x, m_Position.y, m_Size.x, m_Size.y });
|
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() {
|
void Player::ProcessImGui() {
|
||||||
ImGui::Begin("Collision Info", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
|
ImGui::Begin("Collision Info", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
|
||||||
ImGui::Text("is Grounded: %s", m_Grounded ? "true" : "false");
|
ImGui::Text("is Grounded: %s", m_Grounded ? "true" : "false");
|
||||||
ImGui::Text("Did just dig right: %s", m_DidJustDigRight ? "true" : "false");
|
ImGui::Text("Did just dig right: %s", m_DidJustDigRight ? "true" : "false");
|
||||||
bool test = !utils::isKeyDown(SDL_SCANCODE_H);
|
bool test = !utils::isKeyDown(SDL_SCANCODE_H);
|
||||||
ImGui::Text("Is Key Up H: %s", test ? "true" : "false");
|
ImGui::Text("Is Key Up H: %s", test ? "true" : "false");
|
||||||
|
ImGui::Checkbox("Draw Collision Rect", &m_DrawCollisionRect);
|
||||||
|
|
||||||
//ContactMap
|
//ContactMap
|
||||||
ImGui::Text("ContactMap:");
|
ImGui::Text("ContactMap:");
|
||||||
@@ -39,16 +53,9 @@ void Player::ProcessImGui() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Player::Update(float elapsedTime, WorldLevel& level) {
|
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
|
//check for keys
|
||||||
if (utils::isKeyDown(SDL_SCANCODE_W)) {
|
if (utils::isKeyDown(SDL_SCANCODE_W)) {
|
||||||
m_Vel.y = 100;
|
m_Vel.y = 100;
|
||||||
@@ -65,23 +72,23 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
|
|||||||
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;
|
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;
|
m_Vel.x = -100;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (utils::isKeyDown(SDL_SCANCODE_D)) {
|
if (utils::isKeyDown(SDL_SCANCODE_D)) {
|
||||||
m_Vel.x = 100;
|
m_Vel.x = 100;
|
||||||
|
m_walkAnimation->SetFlipped(true);
|
||||||
if (m_Grounded && !m_DidJustDigRight) {
|
if (m_Grounded && !m_DidJustDigRight) {
|
||||||
//Check if the player doesnt come from digging a tile
|
//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);
|
m_ContactMap[Collision::CollisionDirection::Right]->SetTileType(Tiles::AIR);
|
||||||
WorldTile* tile = m_ContactMap[Collision::CollisionDirection::Right];
|
WorldTile* tile = m_ContactMap[Collision::CollisionDirection::Right];
|
||||||
//center of tile
|
//center of tile
|
||||||
Point2f tileCenter = tile->GetCollisionRect().getCollisionRect().pos + tile->GetCollisionRect().getCollisionRect().size / 2;
|
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_Position = Point2f { tileCenter.x - m_Size.x / 2, tileCenter.y - m_Size.y / 2 + 5 };
|
||||||
|
|
||||||
m_ContactMap[Collision::CollisionDirection::Right] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Right] = nullptr;
|
||||||
@@ -95,6 +102,9 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_walkAnimation->Update(elapsedTime);
|
||||||
|
|
||||||
|
|
||||||
m_ContactMap[Collision::CollisionDirection::Top] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Top] = nullptr;
|
||||||
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Bottom] = nullptr;
|
||||||
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
|
m_ContactMap[Collision::CollisionDirection::Left] = nullptr;
|
||||||
@@ -107,7 +117,7 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
|
|||||||
|
|
||||||
std::vector<std::pair<int, float>> contactTimes {};
|
std::vector<std::pair<int, float>> contactTimes {};
|
||||||
|
|
||||||
WorldGridManager& gridManager = level.GetGridManager();
|
const WorldGridManager& gridManager = level.GetGridManager();
|
||||||
|
|
||||||
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
|
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
|
||||||
for (int y { 0 }; y < WORLD_HEIGHT; ++y) {
|
for (int y { 0 }; y < WORLD_HEIGHT; ++y) {
|
||||||
@@ -115,13 +125,14 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
|
|||||||
if (*tile->GetTileType() != Tiles::AIR) {
|
if (*tile->GetTileType() != Tiles::AIR) {
|
||||||
tile->m_Hightlight = false;
|
tile->m_Hightlight = false;
|
||||||
if (Collision::DynamicRectVsRect(this->GetCollisionRect(), elapsedTime, tile->GetCollisionRect().getCollisionRect(), intersectionPoint, normal, t)) {
|
if (Collision::DynamicRectVsRect(this->GetCollisionRect(), elapsedTime, tile->GetCollisionRect().getCollisionRect(), intersectionPoint, normal, t)) {
|
||||||
contactTimes.push_back(std::pair<int, float>{x + y * WORLD_WIDTH, 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;
|
return a.second < b.second;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -164,6 +175,24 @@ void Player::Update(float elapsedTime, WorldLevel& level) {
|
|||||||
Collision::ResolvePlayerVsRect(*this, elapsedTime, &rect);
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,24 +1,60 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
|
#include "TextureManager.h"
|
||||||
|
#include "Animations/Animation.h"
|
||||||
|
|
||||||
class WorldLevel;
|
class WorldLevel;
|
||||||
|
|
||||||
|
enum class PlayerState
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Walking,
|
||||||
|
Digging,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class PlayerDirection
|
||||||
|
{
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DigDirection
|
||||||
|
{
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Down
|
||||||
|
};
|
||||||
|
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Player(const Point2f& Position, TextureManager* pTextureManager);
|
||||||
Player(const Point2f& Position);
|
Collision::CollisionRect GetCollisionRect() const;
|
||||||
Collision::CollisionRect GetCollisionRect();
|
|
||||||
void Update(float elapsedTime, WorldLevel& level);
|
void Update(float elapsedTime, WorldLevel& level);
|
||||||
void Draw() const;
|
void Draw() const;
|
||||||
|
|
||||||
void SetPosition(Point2f pos) { m_Position = pos; }
|
void SetPosition(Point2f pos) {
|
||||||
Point2f GetPosition() const { return m_Position; }
|
m_Position = pos;
|
||||||
|
}
|
||||||
|
Point2f GetPosition() const {
|
||||||
|
return m_Position;
|
||||||
|
}
|
||||||
|
|
||||||
void SetVelocity(Point2f vel) { m_Vel = vel; }
|
void SetVelocity(Point2f vel) {
|
||||||
Point2f GetVelocity() const { return m_Vel; }
|
m_Vel = vel;
|
||||||
|
}
|
||||||
|
Point2f GetVelocity() const {
|
||||||
|
return m_Vel;
|
||||||
|
}
|
||||||
|
|
||||||
auto GetContactMap(){ return m_ContactMap; }
|
auto GetContactMap() {
|
||||||
void SetContactMap(Collision::CollisionDirection dir, WorldTile* tile) { m_ContactMap[dir] = tile; }
|
return m_ContactMap;
|
||||||
|
}
|
||||||
|
void SetContactMap(Collision::CollisionDirection dir, WorldTile* tile) {
|
||||||
|
m_ContactMap[dir] = tile;
|
||||||
|
}
|
||||||
|
|
||||||
void ProcessImGui();
|
void ProcessImGui();
|
||||||
|
|
||||||
@@ -36,4 +72,12 @@ private:
|
|||||||
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 };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "TextureManager.h"
|
#include "TextureManager.h"
|
||||||
TextureManager* TextureManager::m_pInstance = NULL;
|
TextureManager* TextureManager::m_pInstance = nullptr;
|
||||||
|
|
||||||
TextureManager * TextureManager::GetInstance() {
|
TextureManager * TextureManager::GetInstance() {
|
||||||
if (m_pInstance == nullptr) {
|
if (m_pInstance == nullptr) {
|
||||||
@@ -16,3 +16,6 @@ Texture* TextureManager::GetTexture(const std::string& name) {
|
|||||||
m_Textures[name] = pTexture;
|
m_Textures[name] = pTexture;
|
||||||
return pTexture;
|
return pTexture;
|
||||||
}
|
}
|
||||||
|
TextureManager::~TextureManager() {
|
||||||
|
//TODO: Loop over the m_Textures to delete them
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
class TextureManager
|
class TextureManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureManager() = default;
|
|
||||||
|
|
||||||
static TextureManager * GetInstance();
|
static TextureManager * GetInstance();
|
||||||
|
|
||||||
Texture * GetTexture(const std::string& name);
|
Texture * GetTexture(const std::string& name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TextureManager() = default;
|
||||||
|
~TextureManager();
|
||||||
static TextureManager* m_pInstance;
|
static TextureManager* m_pInstance;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, Texture *> m_Textures {};
|
std::map<std::string, Texture *> m_Textures {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,16 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
WorldLevel::WorldLevel(Camera* camera, Rectf viewport):
|
WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
|
||||||
Level(camera),
|
|
||||||
m_gridManager(WorldGridManager()),
|
m_gridManager(WorldGridManager()),
|
||||||
m_player(Player { Point2f { 0, 100 } }),
|
m_player(Player { Point2f { 0, 100 }, TextureManager::GetInstance() }),
|
||||||
m_mousePos { 0, 0 },
|
m_mousePos { 0, 0 },
|
||||||
m_viewport(viewport)
|
m_viewport(viewport) {
|
||||||
{
|
|
||||||
// The grid is 34 x 50 big, the top center is 0,0 in world coords
|
// 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 x { 0 }; x < WORLD_WIDTH; ++x) {
|
||||||
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
|
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
|
||||||
int actualX = x - WORLD_WIDTH / 2;
|
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;
|
GroundTileType* type = Tiles::AIR;
|
||||||
switch (utils::randRange(0, 2)) {
|
switch (utils::randRange(0, 2)) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -38,7 +36,6 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport):
|
|||||||
std::cout << "??" << std::endl;
|
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() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +136,8 @@ void WorldLevel::ProcessImGui() {
|
|||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
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();
|
ImGui::EndMainMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,34 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Level.h"
|
|
||||||
#include "Texture.h"
|
|
||||||
#include "WorldLevel.h"
|
|
||||||
#include "WorldTile.h"
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
|
#include "Level.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "WorldGridManager.h"
|
#include "WorldLevel.h"
|
||||||
|
#include "GridSystem/WorldGridManager.h"
|
||||||
|
|
||||||
|
|
||||||
class WorldLevel : public Level {
|
class WorldLevel : public Level
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
WorldLevel(Camera* camera, Rectf viewport);
|
WorldLevel(Camera* camera, Rectf viewport);
|
||||||
~WorldLevel() override;
|
~WorldLevel() override;
|
||||||
|
|
||||||
|
WorldLevel(const WorldLevel& other) = default;
|
||||||
|
WorldLevel(WorldLevel&& other) = default;
|
||||||
|
|
||||||
void Update(float elapsedSec) override;
|
void Update(float elapsedSec) override;
|
||||||
void Draw() const override;
|
void Draw() const override;
|
||||||
|
|
||||||
void MouseMove(const Point2f& mousePos) override;
|
void MouseMove(const Point2f& mousePos) override;
|
||||||
void ProcessImGui() override;
|
void ProcessImGui() override;
|
||||||
|
|
||||||
WorldGridManager& GetGridManager() { return m_gridManager; }
|
WorldGridManager& GetGridManager() {
|
||||||
|
return m_gridManager;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Collision::CollisionRect> m_Rects;
|
std::vector<Collision::CollisionRect> m_Rects;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
WorldGridManager m_gridManager {};
|
WorldGridManager m_gridManager {};
|
||||||
Player m_player;
|
Player m_player;
|
||||||
Point2f m_mousePos {};
|
Point2f m_mousePos {};
|
||||||
|
|||||||
@@ -6,13 +6,12 @@
|
|||||||
void StartHeapControl();
|
void StartHeapControl();
|
||||||
void DumpMemoryLeaks();
|
void DumpMemoryLeaks();
|
||||||
|
|
||||||
int SDL_main(int argv, char** args)
|
int SDL_main(int argv, char** args) {
|
||||||
{
|
|
||||||
srand(static_cast<unsigned int>(time(nullptr)));
|
srand(static_cast<unsigned int>(time(nullptr)));
|
||||||
|
|
||||||
StartHeapControl();
|
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();
|
pGame->Run();
|
||||||
delete pGame;
|
delete pGame;
|
||||||
|
|
||||||
|
|||||||
BIN
Resources/animations/player/player_walk.png
Normal file
BIN
Resources/animations/player/player_walk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user