summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/game-settings.cpp3
-rw-r--r--src/game-settings.hpp26
-rw-r--r--src/game.cpp3
-rw-r--r--src/game.hpp19
-rw-r--r--src/main.cpp1
-rw-r--r--src/window.cpp1
7 files changed, 34 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57eccfb..1d7bbc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,8 @@ set(PKE_SOURCE_FILES
src/event.cpp
src/game.hpp
src/game.cpp
+ src/game-settings.hpp
+ src/game-settings.cpp
src/helpers.hpp
src/helpers.cpp
src/memory.hpp
diff --git a/src/game-settings.cpp b/src/game-settings.cpp
new file mode 100644
index 0000000..6f09432
--- /dev/null
+++ b/src/game-settings.cpp
@@ -0,0 +1,3 @@
+#include "game-settings.hpp"
+
+GameSettings pkeSettings{};
diff --git a/src/game-settings.hpp b/src/game-settings.hpp
new file mode 100644
index 0000000..2f7fb26
--- /dev/null
+++ b/src/game-settings.hpp
@@ -0,0 +1,26 @@
+#ifndef PKE_GAME_SETTINGS_HPP
+#define PKE_GAME_SETTINGS_HPP
+
+#include <cstdint>
+
+struct GameSettings {
+ bool isGameRunning = true;
+ bool isGamePaused = false;
+ bool isFramerateUnlocked = true;
+ bool isShowingEditor = true;
+ bool isRenderingDebug = false;
+ int64_t targetFPS = 144;
+ int64_t minFPS = 20;
+ double deltaPerFrame = 1 / double(targetFPS);
+ double minimumDeltaPerFrame = 1 / double(minFPS);
+ struct {
+ bool isShowingConsole = true;
+ bool isShowingEntityList = true;
+ bool isShowingSceneEditor = true;
+ bool isShowingUBO = true;
+ } editorSettings;
+};
+
+extern GameSettings pkeSettings;
+
+#endif /* PKE_GAME_SETTINGS_HPP */
diff --git a/src/game.cpp b/src/game.cpp
index fd609da..0738984 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2,12 +2,11 @@
#include "game.hpp"
#include "vendor/glm_include.hpp"
+#include "game-settings.hpp"
#include <cstring>
#include <iomanip>
-GameSettings pkeSettings{};
-
const uint64_t consoleBufferCount = 30;
const uint64_t consoleLineLength = 128;
const long readLineLength = 128;
diff --git a/src/game.hpp b/src/game.hpp
index 2156c8f..69b916c 100644
--- a/src/game.hpp
+++ b/src/game.hpp
@@ -19,25 +19,6 @@ using GameTimePoint = std::chrono::steady_clock::time_point;
#define NANO_DENOM std::chrono::nanoseconds::period::den
#define NANO_DENOM_DOUBLE double(std::chrono::nanoseconds::period::den)
-struct GameSettings {
- bool isGameRunning = true;
- bool isGamePaused = false;
- bool isFramerateUnlocked = true;
- bool isShowingEditor = true;
- int64_t targetFPS = 144;
- int64_t minFPS = 20;
- double deltaPerFrame = 1 / double(targetFPS);
- double minimumDeltaPerFrame = 1 / double(minFPS);
- struct {
- bool isShowingConsole = true;
- bool isShowingEntityList = true;
- bool isShowingSceneEditor = true;
- bool isShowingUBO = true;
- } editorSettings;
-};
-
-extern GameSettings pkeSettings;
-
void Game_Init();
void Game_Tick(double delta);
void Game_Teardown();
diff --git a/src/main.cpp b/src/main.cpp
index b4b1902..a587b88 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -11,6 +11,7 @@
#include "game.hpp"
#include "window.hpp"
#include "entities.hpp"
+#include "game-settings.hpp"
void signal_handler(int signal_num) {
printf("Received signal: %d - shutting down\n", signal_num);
diff --git a/src/window.cpp b/src/window.cpp
index 0a43072..857e6e9 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -5,6 +5,7 @@
#include "glm/ext/matrix_transform.hpp"
#include "glm/gtc/matrix_transform.hpp"
+#include "game-settings.hpp"
#define NELEMS(x) (sizeof(x) / sizeof((x)[0]))