Scene change support
This commit is contained in:
25
src/dawn/games/vn/events/VNSceneChangeEvent.hpp
Normal file
25
src/dawn/games/vn/events/VNSceneChangeEvent.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "VNEvent.hpp"
|
||||
#include "scene/Scene.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
template<class T>
|
||||
class VNSceneChangeEvent : public VNEvent {
|
||||
protected:
|
||||
void onStart() override {
|
||||
auto game = this->manager->getGame();
|
||||
T *nextScene = new T(this->manager->getGame());
|
||||
|
||||
auto assets = nextScene->getRequiredAssets();
|
||||
game->assetManager.queueLoad(assets);
|
||||
game->assetManager.syncLoad();
|
||||
nextScene->stage();
|
||||
game->sceneCutover(nextScene);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user