diff --git a/.idea/.idea.Motherload/.idea/workspace.xml b/.idea/.idea.Motherload/.idea/workspace.xml
index 14ac547..562475c 100644
--- a/.idea/.idea.Motherload/.idea/workspace.xml
+++ b/.idea/.idea.Motherload/.idea/workspace.xml
@@ -11,22 +11,21 @@
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-
+
@@ -41,82 +40,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -155,28 +78,28 @@
- {
- "keyToString": {
- "C++ Project.Game.executor": "Debug",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "ignore.virus.scanning.warn.message": "true",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -324,7 +247,10 @@
-
+
+
+
+
diff --git a/Engine/Text.cpp b/Engine/Text.cpp
index 8fefdf4..5e22aa1 100644
--- a/Engine/Text.cpp
+++ b/Engine/Text.cpp
@@ -1,7 +1,7 @@
#include "Text.h"
#include
-Text::Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color): m_Text(text), m_FontPath(fontPath), m_Color(color) {
+Text::Text(const std::string& text, const std::string& fontPath, int size, const Color4f& color): m_Text(text), m_FontPath(fontPath), m_Size(size), m_Color(color) {
m_Texture = new Texture(text, fontPath, size, color);
m_IsCreatedOk = m_Texture->IsCreationOk();
if(!m_IsCreatedOk) {
@@ -14,5 +14,17 @@ Text::~Text() {
}
}
void Text::Draw(const Vector2f& pos) const {
- m_Texture->Draw(pos);
+ if(m_IsCreatedOk) {
+ m_Texture->Draw(pos);
+ } else {
+ std::cout << "Trying to render a Text that is not correctly made,\nText: " << m_Text << std::endl;
+ }
+}
+void Text::ChangeText(const std::string& text) {
+ if(m_IsCreatedOk && m_Texture->IsCreationOk()) {
+ delete m_Texture;
+ m_Texture = new Texture(text, m_FontPath, m_Size, m_Color);
+ } else {
+ std::cout << "This is wierd??: " << m_Text << std::endl;
+ }
}
diff --git a/Engine/Text.h b/Engine/Text.h
index 71fb917..adfb558 100644
--- a/Engine/Text.h
+++ b/Engine/Text.h
@@ -13,11 +13,14 @@ public:
void Draw(const Vector2f& pos) const;
+ void ChangeText(const std::string& text);
+
private:
std::string m_Text;
std::string m_FontPath;
+ int m_Size;
Color4f m_Color;
Texture* m_Texture;
bool m_IsCreatedOk{ false };
diff --git a/Game/Game.cpp b/Game/Game.cpp
index 07555fd..cc35ed2 100644
--- a/Game/Game.cpp
+++ b/Game/Game.cpp
@@ -5,7 +5,7 @@
#include
#include "colors.h"
-#include "GroundTileTypeManager.h"
+#include "GridSystem/GroundTileTypeManager.h"
#include "utils.h"
#include "GridSystem/WorldTile.h"
#include "Levels/World/WorldLevel.h"
diff --git a/Game/Game.vcxproj b/Game/Game.vcxproj
index 7863e40..035089c 100644
--- a/Game/Game.vcxproj
+++ b/Game/Game.vcxproj
@@ -157,6 +157,80 @@
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ true
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ Use
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
MultiThreadedDebugDll
EnableFastChecks
@@ -307,10 +381,83 @@
true
true
-
+
+ MultiThreadedDebugDll
+ EnableFastChecks
+ Disabled
+ true
+ NoListing
+ x64\Debug\
+ false
+ true
+ x64\Debug\
+ Default
+ true
+ Column
+ false
+ Prompt
+ false
+ Sync
+ false
+ false
+ false
+ NotSet
+ Precise
+ true
+ false
+ false
+ false
+ Default
+ false
+ false
+ Default
+ Default
+ false
+ x64\Debug\
+ x64\Debug\
+ false
+ Neither
+ false
+ x64\Debug\
+ Cdecl
+ x64\Debug\vc143.pdb
+ Use
+ pch.h
+ x64\Debug\Game.pch
+ false
+ false
+ false
+ true
+ false
+ false
+ x64\Debug\
+ true
+ true
+ false
+ false
+ Default
+ x64\Debug\Game.tlog\
+ false
+ true
+ false
+ true
+ true
+ Level3
+ x64\Debug\
+ EditAndContinue
+ false
+ false
+ false
+ InheritWarningLevel
+ true
+ false
+ _DEBUG;_CONSOLE;_UNICODE;UNICODE;
+ true
+ true
+
@@ -478,12 +625,13 @@
+
-
+
diff --git a/Game/GroundTileTypeManager.cpp b/Game/GridSystem/GroundTileTypeManager.cpp
similarity index 100%
rename from Game/GroundTileTypeManager.cpp
rename to Game/GridSystem/GroundTileTypeManager.cpp
diff --git a/Game/GroundTileTypeManager.h b/Game/GridSystem/GroundTileTypeManager.h
similarity index 100%
rename from Game/GroundTileTypeManager.h
rename to Game/GridSystem/GroundTileTypeManager.h
diff --git a/Game/Gui/GuiText.cpp b/Game/Gui/GuiText.cpp
new file mode 100644
index 0000000..ddb2e56
--- /dev/null
+++ b/Game/Gui/GuiText.cpp
@@ -0,0 +1,26 @@
+#include "pch.h"
+#include "GuiText.h"
+
+#include "colors.h"
+GuiText::GuiText(const Vector2f& position, const std::string& text, const std::string& fontPath, int size, const Color4f& color): m_Position(position), m_Text(new Text(text, fontPath, size, color)) {
+
+}
+
+GuiText::GuiText(): m_Position(100,100), m_Text(new Text("Undefined", "fonts/verdana.ttf", 10, Colors::WHITE)) {
+
+}
+
+void GuiText::Draw() const {
+ m_Text->Draw(m_Position);
+}
+
+void GuiText::Update(float elapsedSec) {
+}
+
+void GuiText::ChangeText(const std::string& text) const {
+ m_Text->ChangeText(text);
+
+}
+GuiText::~GuiText() {
+ delete m_Text;
+}
diff --git a/Game/Gui/GuiText.h b/Game/Gui/GuiText.h
new file mode 100644
index 0000000..0b3d210
--- /dev/null
+++ b/Game/Gui/GuiText.h
@@ -0,0 +1,20 @@
+#pragma once
+#include "GuiElement.h"
+#include "Text.h"
+#include "Texture.h"
+
+class GuiText : public GuiElement {
+public:
+ GuiText(const Vector2f& position, const std::string& text, const std::string& fontPath, int size, const Color4f& color);
+ GuiText();
+
+ void Draw() const override;
+ void Update(float elapsedSec) override;
+
+ void ChangeText(const std::string& text) const;
+
+ ~GuiText() override;
+private:
+ Vector2f m_Position;
+ Text* m_Text;
+};
diff --git a/Game/Gui/Screens/MainScreen.cpp b/Game/Gui/Screens/MainScreen.cpp
index e6fa826..9e84d42 100644
--- a/Game/Gui/Screens/MainScreen.cpp
+++ b/Game/Gui/Screens/MainScreen.cpp
@@ -1,8 +1,23 @@
#include "pch.h"
#include "MainScreen.h"
+
+#include "colors.h"
+#include "utils.h"
+#include "Gui/GuiText.h"
MainScreen::MainScreen(TextureManager* manager) : Screen("", Vector2f{0, 0}, Vector2f{900.f, 500.f}, manager) {
- m_FuelMeter = new GuiMeter("gui/main/fuel/fuel.png", Vector2f{20, 500.f - 146 / 1.5 - 20}, Vector2f{336, 146},Vector2f{336 / 2, 146 / 1.5}, 21, manager);
+ Vector2f ScreenSize = utils::GetViewport();
+ Vector2f FuelFrameSize{ 336, 77 };
+ Vector2f HullFrameSize{ 61, 76 };
+
+ m_FuelMeter = new GuiMeter("gui/main/fuel/fuel.png", Vector2f{HullFrameSize.x + 10, ScreenSize.y - FuelFrameSize.y }, FuelFrameSize,FuelFrameSize / 1.3, 21, manager);
this->AddElement(m_FuelMeter);
+
+ m_HullMeter = new GuiMeter("gui/main/hull/hull.png", Vector2f{5, ScreenSize.y - HullFrameSize.y - 10 }, HullFrameSize, HullFrameSize, 50, manager);
+ this->AddElement(m_HullMeter);
+
+ Vector2f DepthMeterPosition{10, ScreenSize.y - 120};
+ m_DepthText = new GuiText(DepthMeterPosition, "Depth: 20", "fonts/Arial.ttf", 20, Colors::YELLOW);
+ this->AddElement(m_DepthText);
}
MainScreen::~MainScreen() = default;
void MainScreen::Draw() const {
@@ -14,3 +29,10 @@ void MainScreen::Update(float elapsedSecs) {
void MainScreen::SetFuelMeterValue(float value) const {
m_FuelMeter->SetValue(value);
}
+void MainScreen::SetHullMeterValue(float value) const {
+ m_HullMeter->SetValue(value);
+}
+void MainScreen::SetDepth(const std::string& text) const {
+ m_DepthText->ChangeText(text);
+}
+
diff --git a/Game/Gui/Screens/MainScreen.h b/Game/Gui/Screens/MainScreen.h
index daff08f..a9aa2fc 100644
--- a/Game/Gui/Screens/MainScreen.h
+++ b/Game/Gui/Screens/MainScreen.h
@@ -1,5 +1,6 @@
#pragma once
#include "Gui/GuiMeter.h"
+#include "Gui/GuiText.h"
#include "Gui/Screen.h"
class MainScreen: public Screen {
@@ -11,8 +12,14 @@ public:
virtual void Update(float elapsedSecs) override;
void SetFuelMeterValue(float value) const;
+ void SetHullMeterValue(float value) const;
+
+ void SetDepth(const std::string& text) const;
private:
GuiMeter* m_FuelMeter;
+ GuiMeter* m_HullMeter;
+
+ GuiText* m_DepthText;
};
diff --git a/Game/Levels/World/Building.cpp b/Game/Levels/World/Building.cpp
index a0f764e..175782f 100644
--- a/Game/Levels/World/Building.cpp
+++ b/Game/Levels/World/Building.cpp
@@ -6,8 +6,8 @@ Building::Building(const std::string& filePath, const Vector2f& position, Textur
m_Texture = pTextureManager->GetTexture(filePath);
m_Size = Vector2f(m_Texture->GetWidth(), m_Texture->GetHeight());
}
-Building::~Building() {
-}
+Building::~Building() = default;
+
void Building::Draw() const {
m_Texture->Draw(m_Position);
}
diff --git a/Game/Levels/World/WorldLevel.cpp b/Game/Levels/World/WorldLevel.cpp
index 43bfc98..3051072 100644
--- a/Game/Levels/World/WorldLevel.cpp
+++ b/Game/Levels/World/WorldLevel.cpp
@@ -8,7 +8,7 @@
#include "Collision.h"
#include "colors.h"
-#include "GroundTileTypeManager.h"
+#include "../../GridSystem/GroundTileTypeManager.h"
#include "utils.h"
#include "GridSystem/WorldTile.h"
#include "Gui/Screens/ScreenManager.h"
@@ -66,6 +66,7 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
m_topCover = TextureManager::GetInstance()->GetTexture("topBackground.png");
m_MainScreen = new MainScreen(TextureManager::GetInstance());
+
}
WorldLevel::~WorldLevel() {
@@ -79,6 +80,7 @@ void WorldLevel::Update(float elapsedSec) {
m_MousePos = Vector2f { float(mouseX), float(mouseY) };
m_MousePos = m_pCamera->TransformMouse(m_MousePos);
+
// for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
// for (size_t y { 0 }; y < WORLD_HEIGHT; ++y) {
// m_gridManager.GetTileAtIndex(x, y)->m_Hightlight = false;
@@ -133,6 +135,7 @@ void WorldLevel::Update(float elapsedSec) {
}
m_MainScreen->Update(elapsedSec);
+ m_MainScreen->SetDepth(std::to_string((int)-m_Player.GetPosition().y - 50) + " ft.");
//Vector2f playerPos = m_player.GetPosition();
//Vector2f newCameraPos = playerPos;
diff --git a/Game/Levels/World/WorldLevel.h b/Game/Levels/World/WorldLevel.h
index b5f8d2d..4c1ba9b 100644
--- a/Game/Levels/World/WorldLevel.h
+++ b/Game/Levels/World/WorldLevel.h
@@ -6,6 +6,7 @@
#include "GridSystem/WorldGridManager.h"
#include "Gui/Screens/ScreenManager.h"
#include "Camera.h"
+#include "Text.h"
#include "Gui/GuiMeter.h"
#include "Gui/Screens/MainScreen.h"
#include "Particle/Particle.h"
@@ -47,7 +48,7 @@ private:
MainScreen* m_MainScreen{};
-
+
Texture* m_topCover{ nullptr };
// ImGui Vars
diff --git a/Game/Player.cpp b/Game/Player.cpp
index 5ab45e1..ecc686c 100644
--- a/Game/Player.cpp
+++ b/Game/Player.cpp
@@ -5,7 +5,7 @@
#include
#include "colors.h"
-#include "GroundTileTypeManager.h"
+#include "GridSystem/GroundTileTypeManager.h"
#include "utils.h"
#include "Levels/World/WorldLevel.h"
#include "Animations/Animation.h"
diff --git a/Resources/fonts/Arial.ttf b/Resources/fonts/Arial.ttf
new file mode 100644
index 0000000..45d07e4
Binary files /dev/null and b/Resources/fonts/Arial.ttf differ
diff --git a/Resources/gui/main/fuel/fuel.png b/Resources/gui/main/fuel/fuel.png
index 3f7ebe1..0278dfe 100644
Binary files a/Resources/gui/main/fuel/fuel.png and b/Resources/gui/main/fuel/fuel.png differ
diff --git a/Resources/gui/main/hull/hull.png b/Resources/gui/main/hull/hull.png
new file mode 100644
index 0000000..2f2559c
Binary files /dev/null and b/Resources/gui/main/hull/hull.png differ