Fixed all my pointers

This commit is contained in:
2022-10-19 19:44:47 -07:00
parent f0cbae4cf8
commit acc9d798cb
31 changed files with 289 additions and 141 deletions

View File

@ -29,7 +29,9 @@ namespace Dawn {
*/
class DawnHostData;
class DawnHost {
class DawnHost :
public std::enable_shared_from_this<DawnHost>
{
public:
std::unique_ptr<DawnHostData> data;
@ -49,7 +51,7 @@ namespace Dawn {
* @param game Game instance that this host is running for.
* @return A status code, where DAWN_HOST_INIT_RESULT_SUCCESS is success.
*/
int32_t init(std::weak_ptr<DawnGame> game);
int32_t init(DawnGame &game);
/**
* Request to start the main loop. This method may not exist and may not
@ -61,7 +63,7 @@ namespace Dawn {
* @param game Game instance that this host is running for.
* @return A status code, refer to DAWN_HOST_START_RESULT_{} definitions.
*/
virtual int32_t start(std::weak_ptr<DawnGame> game);
virtual int32_t start(DawnGame &game);
/**
* Requests the host to perform a main-thread update.
@ -70,7 +72,7 @@ namespace Dawn {
* @param delta How much time has passed (in seconds) since the last tick.
* @return A status code, refer to DAWN_HOST_UPDATE_RESULT_{} definitions.
*/
int32_t update(std::weak_ptr<DawnGame> game, float_t delta);
int32_t update(DawnGame &game, float_t delta);
/**
* Request the host to be unloaded. This is a bit different from dispose
@ -79,7 +81,7 @@ namespace Dawn {
*
* @param game Game instance that this host is running for.
*/
void unload(std::weak_ptr<DawnGame> game);
void unload(DawnGame &game);
/**
* Destroy (and unload) all of the DawnHost data from memory.