Add more ores
Add weighted random distribution
93
.idea/.idea.Motherload/.idea/workspace.xml
generated
@@ -12,12 +12,23 @@
|
|||||||
<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 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$/.idea/.idea.Motherload/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Engine/utils.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/utils.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Engine/BaseGame.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/BaseGame.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Engine/BaseGame.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/BaseGame.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/GridSystem/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Game/Levels/World/Building.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/Building.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Game/Player.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Resources/tiles/dirt/special/hardLeft.png" beforeDir="false" afterPath="$PROJECT_DIR$/Resources/tiles/dirt/special/hardLeft.png" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Game/Player.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Game/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/main.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Lava_1.jpg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Lava_2.jpg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Lava_3.jpg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Stone_1.jpg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Stone_2.jpg" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Resources/tiles/ores/Ore_Stone_3.jpg" beforeDir="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" />
|
||||||
@@ -32,11 +43,12 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="HighlightingSettingsPerFile">
|
<component name="HighlightingSettingsPerFile">
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$PROJECT_DIR$/../../../../../../Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/include/type_traits" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/../../../../../../Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/include/vector" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/../../../../../../Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/include/vector" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/Game/Animations/Animation.h" root0="FORCE_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/Game/Animations/Animation.h" root0="FORCE_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/Game/Camera.cpp" root0="FORCE_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/Game/Camera.cpp" root0="FORCE_HIGHLIGHTING" />
|
||||||
<setting file="mock://C:/Users/Bram/Desktop/Programming 2/Exam/dae16-VerhulstBram/Game/main.cpp" root0="SKIP_HIGHLIGHTING" />
|
|
||||||
<setting file="mock://C:/Users/Bram/Desktop/Programming 2/Exam/dae16-VerhulstBram/Game/main.cpp" root0="SKIP_HIGHLIGHTING" />
|
|
||||||
<setting file="file://$PROJECT_DIR$/Game/pch.cpp" root0="FORCE_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/Game/pch.cpp" root0="FORCE_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/Game/pch.h" root0="FORCE_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/Game/pch.h" root0="FORCE_HIGHLIGHTING" />
|
||||||
</component>
|
</component>
|
||||||
@@ -56,28 +68,28 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"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",
|
"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": "com.github.MitI_7.IDEOMApplicationPlugin",
|
"settings.editor.selected.configurable": "preferences.CppConfiguration",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"rider.external.source.directories": [
|
"rider.external.source.directories": [
|
||||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
|
||||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
|
||||||
"C:\\Users\\Bram\\AppData\\Local\\Symbols\\src"
|
"C:\\Users\\Bram\\AppData\\Local\\Symbols\\src"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
<configuration name="Game" type="CppProject" factoryName="C++ Project">
|
<configuration name="Game" type="CppProject" factoryName="C++ Project">
|
||||||
<configuration_1>
|
<configuration_1>
|
||||||
@@ -90,6 +102,7 @@
|
|||||||
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="FORCE_CONSOLE" />
|
||||||
</configuration_1>
|
</configuration_1>
|
||||||
<configuration_2>
|
<configuration_2>
|
||||||
<option name="CONFIGURATION" value="Debug" />
|
<option name="CONFIGURATION" value="Debug" />
|
||||||
@@ -101,6 +114,7 @@
|
|||||||
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="FORCE_CONSOLE" />
|
||||||
</configuration_2>
|
</configuration_2>
|
||||||
<configuration_3>
|
<configuration_3>
|
||||||
<option name="CONFIGURATION" value="Release" />
|
<option name="CONFIGURATION" value="Release" />
|
||||||
@@ -112,6 +126,7 @@
|
|||||||
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="FORCE_CONSOLE" />
|
||||||
</configuration_3>
|
</configuration_3>
|
||||||
<configuration_4>
|
<configuration_4>
|
||||||
<option name="CONFIGURATION" value="Release" />
|
<option name="CONFIGURATION" value="Release" />
|
||||||
@@ -123,8 +138,10 @@
|
|||||||
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="FORCE_CONSOLE" />
|
||||||
</configuration_4>
|
</configuration_4>
|
||||||
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/Game/Game.vcxproj" />
|
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/Game/Game.vcxproj" />
|
||||||
|
<option name="AUTO_SELECT_PRIORITY" value="0" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Build" />
|
<option name="Build" />
|
||||||
</method>
|
</method>
|
||||||
@@ -189,7 +206,12 @@
|
|||||||
<workItem from="1713546379562" duration="319000" />
|
<workItem from="1713546379562" duration="319000" />
|
||||||
<workItem from="1713609308065" duration="368000" />
|
<workItem from="1713609308065" duration="368000" />
|
||||||
<workItem from="1713624356487" duration="8634000" />
|
<workItem from="1713624356487" duration="8634000" />
|
||||||
<workItem from="1713734301178" duration="2970000" />
|
<workItem from="1713734301178" duration="3251000" />
|
||||||
|
<workItem from="1713766349366" duration="8674000" />
|
||||||
|
<workItem from="1713792332342" duration="63000" />
|
||||||
|
<workItem from="1713796697935" duration="987000" />
|
||||||
|
<workItem from="1713807176793" duration="5224000" />
|
||||||
|
<workItem from="1713817523511" duration="347000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Rework Tile detection system">
|
<task id="LOCAL-00001" summary="Rework Tile detection system">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -263,13 +285,22 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1713637256627</updated>
|
<updated>1713637256627</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="10" />
|
<task id="LOCAL-00010" summary="Added Buildings Fixed rendering bugs with edges">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1713738730939</created>
|
||||||
|
<option name="number" value="00010" />
|
||||||
|
<option name="presentableId" value="LOCAL-00010" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1713738730939</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="11" />
|
||||||
<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="UnityCheckinConfiguration" checkUnsavedScenes="true" />
|
||||||
|
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
||||||
<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" />
|
<MESSAGE value="Rework Tile detection system" />
|
||||||
@@ -281,14 +312,8 @@
|
|||||||
<MESSAGE value="Pre Point2f Nuke Fixed drawing, Added general optimisations" />
|
<MESSAGE value="Pre Point2f Nuke Fixed drawing, Added general optimisations" />
|
||||||
<MESSAGE value="Remove Point2f, replace with Vector2f" />
|
<MESSAGE value="Remove Point2f, replace with Vector2f" />
|
||||||
<MESSAGE value="Fix digging" />
|
<MESSAGE value="Fix digging" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Fix digging" />
|
<MESSAGE value="Added Buildings Fixed rendering bugs with edges" />
|
||||||
</component>
|
<option name="LAST_COMMIT_MESSAGE" value="Added Buildings Fixed rendering bugs with edges" />
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<watches-manager>
|
|
||||||
<configuration name="CppProject">
|
|
||||||
<watch expression="m_IsHovered" />
|
|
||||||
</configuration>
|
|
||||||
</watches-manager>
|
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
|||||||
BIN
DevAssets/BuildingPlacement.psd
Normal file
@@ -197,6 +197,9 @@ void BaseGame::Run()
|
|||||||
e.button.y = int(m_Window.height) - e.button.y;
|
e.button.y = int(m_Window.height) - e.button.y;
|
||||||
this->ProcessMouseUpEvent(e.button);
|
this->ProcessMouseUpEvent(e.button);
|
||||||
break;
|
break;
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
this->ProcessMouseWheelEvent(e.wheel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,49 +7,39 @@
|
|||||||
class BaseGame
|
class BaseGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BaseGame( const Window& window );
|
explicit BaseGame(const Window& window);
|
||||||
BaseGame( const BaseGame& other ) = delete;
|
BaseGame(const BaseGame& other) = delete;
|
||||||
BaseGame& operator=( const BaseGame& other ) = delete;
|
BaseGame& operator=(const BaseGame& other) = delete;
|
||||||
BaseGame(BaseGame&& other) = delete;
|
BaseGame(BaseGame&& other) = delete;
|
||||||
BaseGame& operator=(BaseGame&& other) = delete;
|
BaseGame& operator=(BaseGame&& other) = delete;
|
||||||
virtual ~BaseGame( );
|
virtual ~BaseGame();
|
||||||
|
|
||||||
void Run( );
|
void Run();
|
||||||
|
|
||||||
virtual void Update(float elapsedSec)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
virtual void Update(float elapsedSec) {
|
||||||
}
|
}
|
||||||
virtual void Draw() const
|
virtual void Draw() const {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event handling
|
// Event handling
|
||||||
virtual void ProcessKeyDownEvent(const SDL_KeyboardEvent& e)
|
virtual void ProcessKeyDownEvent(const SDL_KeyboardEvent& e) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void ProcessKeyUpEvent(const SDL_KeyboardEvent& e)
|
virtual void ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e)
|
virtual void ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void ProcessMouseDownEvent(const SDL_MouseButtonEvent& e)
|
virtual void ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void ProcessMouseUpEvent(const SDL_MouseButtonEvent& e)
|
virtual void ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
|
||||||
{
|
}
|
||||||
|
virtual void ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) {
|
||||||
}
|
}
|
||||||
virtual void ProcessImGui(){}
|
|
||||||
|
|
||||||
const Rectf& GetViewPort() const
|
|
||||||
{
|
virtual void ProcessImGui() {
|
||||||
|
}
|
||||||
|
|
||||||
|
const Rectf& GetViewPort() const {
|
||||||
return m_Viewport;
|
return m_Viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +58,6 @@ private:
|
|||||||
const float m_MaxElapsedSeconds;
|
const float m_MaxElapsedSeconds;
|
||||||
|
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
void InitializeGameEngine( );
|
void InitializeGameEngine();
|
||||||
void CleanupGameEngine( );
|
void CleanupGameEngine();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
|
|||||||
m_pCurrentLevel->MouseMove(Vector2f { float(e.x), float(e.y) });
|
m_pCurrentLevel->MouseMove(Vector2f { float(e.x), float(e.y) });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
|
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
|
||||||
@@ -83,6 +84,17 @@ void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
|
|||||||
// break;
|
// break;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
void Game::ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) {
|
||||||
|
Vector2f scroll = Vector2f { 0, 0 };
|
||||||
|
if (e.y > 0) {
|
||||||
|
scroll = Vector2f { 0, 1 };
|
||||||
|
}
|
||||||
|
else if (e.y < 0) {
|
||||||
|
scroll = Vector2f { 0, -1 };
|
||||||
|
}
|
||||||
|
//camera zoom
|
||||||
|
m_Camera.SetScale((m_Camera.GetScale() - e.preciseY * 0.1f));
|
||||||
|
}
|
||||||
void Game::ProcessImGui() {
|
void Game::ProcessImGui() {
|
||||||
m_pCurrentLevel->ProcessImGui();
|
m_pCurrentLevel->ProcessImGui();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
void ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) override;
|
void ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) override;
|
||||||
void ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) override;
|
void ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) override;
|
||||||
void ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) override;
|
void ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) override;
|
||||||
|
void ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) override;
|
||||||
|
|
||||||
void ProcessImGui() override;
|
void ProcessImGui() override;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,29 @@
|
|||||||
#include "WorldGridManager.h"
|
#include "WorldGridManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GroundTileType* getRandomGroundTile() {
|
||||||
|
// Generate a random weight between 0 and the sum of weights
|
||||||
|
float sumWeights = 0.0f;
|
||||||
|
for (const auto& pair : GroundTileWeights) {
|
||||||
|
sumWeights += pair.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
float randomWeight = static_cast<float>(rand()) / RAND_MAX * sumWeights;
|
||||||
|
|
||||||
|
// Find the corresponding ground tile type
|
||||||
|
float cumulativeWeight = 0.0f;
|
||||||
|
for (const auto& pair : GroundTileWeights) {
|
||||||
|
cumulativeWeight += pair.second;
|
||||||
|
if (randomWeight <= cumulativeWeight) {
|
||||||
|
return pair.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should never be reached if weights sum to 1.0
|
||||||
|
return Tiles::AIR; // Default value
|
||||||
|
}
|
||||||
WorldTile::WorldTile(const Vector2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager, WorldGridManager* pGridManager) : m_Position { position }, m_GroundTileType { groundTileType }, m_pGridManager { pGridManager } {
|
WorldTile::WorldTile(const Vector2f& position, GroundTileType* groundTileType, TextureManager* pTextureManager, WorldGridManager* pGridManager) : m_Position { position }, m_GroundTileType { groundTileType }, m_pGridManager { pGridManager } {
|
||||||
// const std::string dirtPath = + "tiles/dirt/dirt" + std::to_string(utils::randRange(1, 5)) + ".png";
|
// const std::string dirtPath = + "tiles/dirt/dirt" + std::to_string(utils::randRange(1, 5)) + ".png";
|
||||||
// m_pTexture = new Texture(dirtPath);
|
// m_pTexture = new Texture(dirtPath);
|
||||||
|
|||||||
@@ -11,11 +11,33 @@ enum class GroundTileTypes
|
|||||||
Air,
|
Air,
|
||||||
Dirt,
|
Dirt,
|
||||||
Grass,
|
Grass,
|
||||||
Hard,
|
|
||||||
Stone,
|
Stone,
|
||||||
Iron
|
Lava,
|
||||||
|
|
||||||
|
//Special
|
||||||
|
Hard,
|
||||||
|
|
||||||
|
//Ores
|
||||||
|
Bronze,
|
||||||
|
Gold,
|
||||||
|
Iron,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::map<GroundTileTypes, std::string> GroundTileTypeStrings {
|
||||||
|
{ GroundTileTypes::Air, "Air" },
|
||||||
|
{ GroundTileTypes::Dirt, "Dirt" },
|
||||||
|
{ GroundTileTypes::Grass, "Grass" },
|
||||||
|
{ GroundTileTypes::Stone, "Stone" },
|
||||||
|
{ GroundTileTypes::Lava, "Lava" },
|
||||||
|
{ GroundTileTypes::Hard, "Hard" },
|
||||||
|
{ GroundTileTypes::Bronze, "Bronze" },
|
||||||
|
{ GroundTileTypes::Gold, "Gold" },
|
||||||
|
{ GroundTileTypes::Iron, "Iron" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GroundTileType * getRandomGroundTile();
|
||||||
|
|
||||||
class GroundTileType
|
class GroundTileType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -90,7 +112,19 @@ 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* DIRT = new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5);
|
||||||
|
|
||||||
|
namespace Hazards
|
||||||
|
{
|
||||||
|
static GroundTileType* STONE = new RandomGroundTile("tiles/ores/Ore_Stone_[0].png", GroundTileTypes::Stone, 3);
|
||||||
|
static GroundTileType* LAVA = new RandomGroundTile("tiles/ores/Ore_Lava_[0].png", GroundTileTypes::Lava, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Ores
|
||||||
|
{
|
||||||
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
||||||
|
static GroundTileType* BRONZE = new GroundTileType("tiles/ores/Ore_Bronzium.png", GroundTileTypes::Bronze);
|
||||||
|
static GroundTileType* GOLD = new GroundTileType("tiles/ores/Ore_Goldium.png", GroundTileTypes::Gold);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Special
|
namespace Special
|
||||||
{
|
{
|
||||||
@@ -102,6 +136,20 @@ namespace Tiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::map<GroundTileType *, float> GroundTileWeights {
|
||||||
|
{ Tiles::AIR, 0.2f },
|
||||||
|
{ Tiles::DIRT, 0.5f },
|
||||||
|
{ Tiles::Special::GRASS, 0.0f },
|
||||||
|
{ Tiles::Hazards::STONE, 0.025f },
|
||||||
|
{ Tiles::Hazards::LAVA, 0.01f },
|
||||||
|
{ Tiles::Special::HARD_LEFT, 0.0f },
|
||||||
|
{ Tiles::Special::HARD_MIDDLE, 0.0f },
|
||||||
|
{ Tiles::Special::HARD_RIGHT, 0.0f },
|
||||||
|
{ Tiles::Ores::BRONZE, 0.05f },
|
||||||
|
{ Tiles::Ores::GOLD, 0.02f },
|
||||||
|
{ Tiles::Ores::IRON, 0.1f },
|
||||||
|
};
|
||||||
|
|
||||||
class WorldTile
|
class WorldTile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -149,7 +197,7 @@ private:
|
|||||||
|
|
||||||
surroundingTiles m_SurroundingTiles;
|
surroundingTiles m_SurroundingTiles;
|
||||||
|
|
||||||
std::vector<Texture*> m_SideTextures { 8, nullptr };
|
std::vector<Texture *> m_SideTextures { 8, nullptr };
|
||||||
|
|
||||||
Texture* m_pAllTexture;
|
Texture* m_pAllTexture;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,15 +6,19 @@ class Building
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Building(const std::string& filePath, const Vector2f& position, TextureManager* pTextureManager);
|
Building(const std::string& filePath, const Vector2f& position, TextureManager* pTextureManager);
|
||||||
|
Building(const Building& other) = delete;
|
||||||
|
Building(Building&& other) = delete;
|
||||||
|
|
||||||
~Building();
|
~Building();
|
||||||
|
|
||||||
void Draw() const;
|
void Draw() const;
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Texture* m_Texture;
|
Texture* m_Texture;
|
||||||
Vector2f m_Position;
|
Vector2f m_Position;
|
||||||
Vector2f m_Size;
|
Vector2f m_Size;
|
||||||
|
|
||||||
|
Rectf m_boundingBox;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,26 +21,12 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
|
|||||||
m_viewport(viewport),
|
m_viewport(viewport),
|
||||||
m_screenManager(ScreenManager::GetInstance()) {
|
m_screenManager(ScreenManager::GetInstance()) {
|
||||||
// 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 (int x { 0 }; x < WORLD_WIDTH; ++x) {
|
||||||
for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
|
for (int y { 0 }; y < WORLD_HEIGHT; ++y) {
|
||||||
const int actualX = x - WORLD_WIDTH / 2;
|
const int actualX = x - WORLD_WIDTH / 2;
|
||||||
Vector2f pos = Vector2f { float(actualX * TILE_WIDTH), -float(y * TILE_HEIGHT) - TILE_HEIGHT };
|
Vector2f pos = Vector2f { float(actualX * TILE_WIDTH), -float(y * TILE_HEIGHT) - TILE_HEIGHT };
|
||||||
GroundTileType* type = Tiles::AIR;
|
GroundTileType* type = getRandomGroundTile();
|
||||||
switch (utils::randRange(0, 2)) {
|
m_gridManager.SetTileAtIndex(x, y, new WorldTile { pos, type, TextureManager::GetInstance(), &m_gridManager });
|
||||||
case 0:
|
|
||||||
type = Tiles::DIRT;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
type = Tiles::IRON;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
//AIR
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::cout << "??" << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
m_gridManager.SetTileAtIndex(x, y, new WorldTile { pos, Tiles::DIRT, TextureManager::GetInstance(), &m_gridManager });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
|
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
|
||||||
@@ -257,9 +243,11 @@ void WorldLevel::ProcessImGui() {
|
|||||||
if (m_ShowCameraWindow) {
|
if (m_ShowCameraWindow) {
|
||||||
ImGui::Begin("Camera", &m_ShowCameraWindow, ImGuiWindowFlags_AlwaysAutoResize);
|
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("Camera Scale: %f", m_pCamera->GetScale());
|
||||||
ImGui::Text("Is Right Mouse Down: %s", utils::isMouseDown(0) ? "true" : "false");
|
ImGui::Text("Is Right Mouse Down: %s", utils::isMouseDown(0) ? "true" : "false");
|
||||||
if (ImGui::Button("Reset Camera")) {
|
if (ImGui::Button("Reset Camera")) {
|
||||||
m_pCamera->SetPosition(Vector2f { -m_viewport.width / 2, -m_viewport.height / 2 });
|
m_pCamera->SetPosition(Vector2f { -m_viewport.width / 2, -m_viewport.height / 2 });
|
||||||
|
m_pCamera->SetScale(1.0f);
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ Player::Player(const Vector2f& Position, TextureManager* manager) : m_Position(P
|
|||||||
m_currentAnimation = m_walkAnimation;
|
m_currentAnimation = m_walkAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player::~Player() {
|
||||||
|
delete m_walkAnimation;
|
||||||
|
delete m_turnAnimation;
|
||||||
|
delete m_digAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
Collision::CollisionRect Player::GetCollisionRect() const {
|
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;
|
||||||
|
|||||||
@@ -30,7 +30,12 @@ enum class DigDirection
|
|||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Player(const Vector2f& Position, TextureManager* pTextureManager);
|
explicit Player(const Vector2f& Position, TextureManager* pTextureManager);
|
||||||
|
Player( const Player& other ) = default;
|
||||||
|
Player(Player&& other) = default;
|
||||||
|
|
||||||
|
~Player();
|
||||||
|
|
||||||
Collision::CollisionRect GetCollisionRect() const;
|
Collision::CollisionRect GetCollisionRect() const;
|
||||||
void Update(float elapsedTime, WorldLevel& level);
|
void Update(float elapsedTime, WorldLevel& level);
|
||||||
void Draw() const;
|
void Draw() const;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
#define DEBUG
|
|
||||||
void StartHeapControl();
|
void StartHeapControl();
|
||||||
void DumpMemoryLeaks();
|
void DumpMemoryLeaks();
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.6 KiB |
BIN
Resources/tiles/ores/Ore_Lava_1.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
BIN
Resources/tiles/ores/Ore_Lava_2.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
BIN
Resources/tiles/ores/Ore_Lava_3.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
BIN
Resources/tiles/ores/Ore_Stone_1.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
BIN
Resources/tiles/ores/Ore_Stone_2.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
BIN
Resources/tiles/ores/Ore_Stone_3.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |