Scene cutover and LoadingScene sample.

This commit is contained in:
2023-10-09 22:26:10 -05:00
parent 8df7cd23ea
commit 2423fd9f70
13 changed files with 81 additions and 10 deletions

View File

@ -40,10 +40,18 @@ int32_t DawnGame::update(float_t delta) {
this->sceneToCutTo = nullptr;
}
if(this->closeRequested) {
return DAWN_GAME_UPDATE_RESULT_EXIT;
}
return DAWN_GAME_UPDATE_RESULT_SUCCESS;
}
void DawnGame::sceneCutover(Scene *scene) {
if(scene == nullptr) scene = this->scene;
this->sceneToCutTo = scene;
}
void DawnGame::close() {
this->closeRequested = true;
}

View File

@ -25,6 +25,7 @@ namespace Dawn {
class DawnGame {
private:
Scene *sceneToCutTo = nullptr;
bool_t closeRequested = false;
public:
DawnHost *host;
@ -75,6 +76,11 @@ namespace Dawn {
* @param scene Scene to cut over to.
*/
void sceneCutover(Scene *scene);
/**
* Gracefully requests that the game should be closed as soon as possible.
*/
void close();
};
/**