/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "../libs.h"
#include "../assert/assert.h"
#include "../util/rand.h"
#include "../input/input.h"
#include "../epoch/epoch.h"
#include "../display/render.h"
#include "../file/assetmanager.h"
#include "../save/save.h"
#include "scene/scenemanager.h"

typedef struct {
  /** Name of the game */
  char *name;

  /** Time Manager for the game */
  epoch_t time;

  /** Render Manager for the game */
  render_t render;

  /** Asset Manager for the game */
  assetmanager_t assetManager;

  /** Input Manager for the game */
  input_t input;

  /** Save Manager for the game */
  savemanager_t save;

  /** Scene Manager for the game */
  scenemanager_t scene;
} engine_t;

/**
 * Initializes the provided engine. This will initialize all of the various
 * managers for the game to use.
 * 
 * @param engine Engine to initialize.
 */
void engineInit(engine_t *engine);

/**
 * Updates the given engine at the start of a frame.
 * 
 * @param engine Engine that is being updated
 * @param delta Delta tick provided by the game's platform.
 */
void engineUpdateStart(engine_t *engine, float delta);

/**
 * Updates the given engine at the end of a frame.
 * 
 * @param engine Engine to update. 
 */
bool engineUpdateEnd(engine_t *engine);

/**
 * Cleanup the engine context.
 * 
 * @param engine Engine to clean up.
 */
void engineDispose(engine_t *engine);