aboutsummaryrefslogtreecommitdiff
path: root/mwe/gameloop/src
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
commite36ea050972fcaaf3d85d672755bad4ebb2dcd80 (patch)
tree5145e0b66650eea1df301106b7d197a586be65f3 /mwe/gameloop/src
parent333b07775be1ef20fdb5909672c1e4dcabec1b40 (diff)
parentb770475741b7c33d57331f3139c55a3f237ad274 (diff)
merge `master` into `loek/savemgr`
Diffstat (limited to 'mwe/gameloop/src')
-rw-r--r--mwe/gameloop/src/loopManager.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/mwe/gameloop/src/loopManager.cpp b/mwe/gameloop/src/loopManager.cpp
index 0392853..49d65fb 100644
--- a/mwe/gameloop/src/loopManager.cpp
+++ b/mwe/gameloop/src/loopManager.cpp
@@ -1,6 +1,12 @@
#include "loopManager.h"
#include "timer.h"
-LoopManager::LoopManager() {}
+LoopManager::LoopManager() { this->window = new WindowManager(); }
+LoopManager::~LoopManager() {
+ for (GameObject * object : this->objectList) {
+ delete object;
+ }
+ delete this->window;
+}
void LoopManager::processInput() {
SDL_Event event;
SDL_PollEvent(&event);
@@ -42,14 +48,14 @@ void LoopManager::loop() {
timer.enforceFrameRate();
}
- window.destroyWindow();
+ window->destroyWindow();
}
void LoopManager::setup() {
- gameRunning = window.initWindow();
- LoopTimer::getInstance().start();
- LoopTimer::getInstance().setFPS(500);
+ LoopTimer::getInstance().start();
+ LoopTimer::getInstance().setFPS(10);
+ this->gameRunning = true;
for (int i = 1; i < 3; i++) {
GameObject * square
= new GameObject("square2", i * 60, i * 60, 20, 20, 0, 0);
@@ -59,7 +65,7 @@ void LoopManager::setup() {
void LoopManager::render() {
fprintf(stderr, "**********render********** \n");
if (gameRunning) {
- window.render(objectList);
+ window->render(objectList);
}
}