about to add SDL and probably break everything

This commit is contained in:
2023-01-16 10:01:06 -08:00
parent 18d3b074f9
commit 7585891276
53 changed files with 891 additions and 132 deletions

View File

@ -4,7 +4,11 @@
// https://opensource.org/licenses/MIT
#include "DawnGame.hpp"
#include "scenes/SubsceneTest.hpp"
#include "scenes/SubSceneRendererScene.hpp"
#include "scenes/Scene_1.hpp"
#include <thread>
#include <chrono>
using namespace Dawn;
@ -22,12 +26,23 @@ int32_t DawnGame::init() {
this->localeManager.init();
this->renderManager.init();
this->scene = new SubsceneTest(this);
this->scene = new SubSceneRendererScene<Scene_4>(this);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}
int32_t DawnGame::update(float_t delta) {
if(this->sceneToCutTo != nullptr) {
if(this->sceneToCutTo == this->scene) {
delete this->scene;
this->scene = nullptr;
} else {
delete this->scene;
this->scene = this->sceneToCutTo;
}
this->sceneToCutTo = nullptr;
}
this->assetManager.update();
this->inputManager.update();
this->timeManager.update(delta);
@ -37,4 +52,10 @@ int32_t DawnGame::update(float_t delta) {
this->renderManager.update();
return DAWN_GAME_UPDATE_RESULT_SUCCESS;
}
void DawnGame::sceneCutover(Scene *scene) {
if(scene == nullptr) scene = this->scene;
this->sceneToCutTo = scene;
}

View File

@ -10,6 +10,9 @@
namespace Dawn {
class DawnGame : public IDawnGame {
private:
Scene *sceneToCutTo = nullptr;
public:
DawnHost *host;
RenderManager renderManager;
@ -22,5 +25,6 @@ namespace Dawn {
DawnGame(DawnHost *host);
int32_t init() override;
int32_t update(float_t delta) override;
void sceneCutover(Scene *scene) override;
};
}