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

#include "world.h"

void worldInit() {
  mapInit();
  entityStateInit();
}

void worldRender() {
  if(ENTITY_STATE.entities[0].type != ENTITY_TYPE_NULL) {
    cameraLookAt(&GAME_STATE.cameraMain,
      ENTITY_STATE.entities[0].positionX,
      ENTITY_STATE.entities[0].positionY - 0.5,
      ENTITY_STATE.entities[0].positionZ + 7,

      ENTITY_STATE.entities[0].positionX,
      ENTITY_STATE.entities[0].positionY,
      ENTITY_STATE.entities[0].positionZ
    );
  }
  mapRender();
  entityStateRender();
}

void worldDispose() {
  entityStateDispose();
  mapDispose();
}