70 lines
2.3 KiB
C++
70 lines
2.3 KiB
C++
// 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"
|
|
#include "locale/LocaleManager.hpp"
|
|
#include "physics/PhysicsManager.hpp"
|
|
#include "save/SaveManager.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 IDawnGame {
|
|
public:
|
|
Scene *scene = nullptr;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
virtual int32_t init() = 0;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
virtual int32_t update(float_t delta) = 0;
|
|
|
|
/**
|
|
* Changes to a new scene, will dispose the currently active scene as part
|
|
* of that process. This assumes the other scene has already been loaded
|
|
* and staged.
|
|
*
|
|
* @param scene Scene to cut over to.
|
|
*/
|
|
virtual void sceneCutover(Scene *scene) = 0;
|
|
|
|
/**
|
|
* Cleanup the memory of the DawnGame instance.
|
|
*/
|
|
virtual ~IDawnGame() {
|
|
|
|
}
|
|
};
|
|
} |