Converted a couple more things to shared pointers.

This commit is contained in:
2023-11-10 20:12:18 -06:00
parent 0beb1d9cb7
commit 732a90931c
16 changed files with 114 additions and 79 deletions

View File

@ -7,9 +7,9 @@
using namespace Dawn;
DawnGame::DawnGame(DawnHost *host) :
DawnGame::DawnGame(const std::weak_ptr<DawnHost> host) :
host(host),
renderManager(this),
renderManager(),
inputManager(this),
saveManager(this)
{
@ -17,7 +17,7 @@ DawnGame::DawnGame(DawnHost *host) :
int32_t DawnGame::init() {
this->assetManager.init();
this->renderManager.init();
this->renderManager.init(weak_from_this());
this->scene = dawnGameGetInitialScene(this);

View File

@ -22,13 +22,13 @@
namespace Dawn {
class DawnHost;
class DawnGame {
class DawnGame : public std::enable_shared_from_this<DawnGame> {
private:
Scene *sceneToCutTo = nullptr;
bool_t closeRequested = false;
public:
DawnHost *host;
const std::weak_ptr<DawnHost> host;
Scene *scene = nullptr;
AssetManager assetManager;
TimeManager timeManager;
@ -41,7 +41,7 @@ namespace Dawn {
*
* @param host Host that executed this game instantiation.
*/
DawnGame(DawnHost *host);
DawnGame(const std::weak_ptr<DawnHost> host);
/**
* Initialize the game. This is performed by the host at a time that is