// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "dawnlibs.hpp" #include "scene/Scene.hpp" #include "display/RenderManager.hpp" #include "asset/AssetManager.hpp" #include "input/InputManager.hpp" #include "time/TimeManager.hpp" #include "input/InputBinds.hpp" #define DAWN_GAME_INIT_RESULT_SUCCESS 0 #define DAWN_GAME_UPDATE_RESULT_SUCCESS 0 #define DAWN_GAME_UPDATE_RESULT_EXIT 1 namespace Dawn { class DawnHost; class DawnGame { public: std::shared_ptr scene; DawnHost &host; RenderManager renderManager; AssetManager assetManager; InputManager inputManager; TimeManager timeManager; /** * Construct a new instance of the DawnGame. * */ DawnGame(DawnHost &host); /** * Initialize the game. This is performed by the host at a time that is * deemed to have the host ready for the game's initialization. This will * return an initialize result, where DAWN_GAME_INIT_RESULT_SUCCESS is * the only "successful" result, anything else is deemed a failure state. * * @param host Pointer to the host that is running this game. * @return The game initialize result. */ int32_t init(); /** * Performs a game update operation. This operation should occur exactly * once per frame, synchronously on the main thread. Updates can only * have two valid exit results, either DAWN_GAME_UPDATE_RESULT_SUCCESS for * a successful update, and request that we continue to update, or * DAWN_GAME_UPDATE_RESULT_EXIT for a successful update but to request * that no more update operations occur. Any other result is considered a * failure state. * * @param delta Time delta to tick the game by. * @return The game update result. */ int32_t update(float_t delta); /** * Cleanup the memory of the DawnGame instance. */ ~DawnGame(); }; }