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

#include "engine.h"

void engineInit(engine_t *engine, game_t *game) {
  epochInit(&engine->time);
  renderInit();
  inputInit(&engine->input);
}

void engineUpdateStart(engine_t *engine, game_t *game, float delta) {
  epochUpdate(&engine->time, delta);
  inputUpdate(&engine->input);
  renderFrameStart(&engine->render);
}

bool engineUpdateEnd(engine_t *engine, game_t *game) {
  if(inputIsPressed(&engine->input, INPUT_NULL)) return false;
  return true;
}

void engineDispose(engine_t *engine, game_t *game) {
  inputDispose(&engine->input);
  renderDispose();
}