39 lines
862 B
C
39 lines
862 B
C
/**
|
|
* Copyright (c) 2024 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "drawstateoverworld.h"
|
|
#include "ui/textbox.h"
|
|
#include "rpg/world/map.h"
|
|
#include "game/game.h"
|
|
#include "display/draw/drawmap.h"
|
|
#include "display/draw/drawui.h"
|
|
|
|
void drawStateOverworld() {
|
|
map_t *map = GAME.currentMap;
|
|
if(map == NULL) return;
|
|
|
|
// Draw the map, based on player position
|
|
entity_t *player = mapEntityGetByType(map, ENTITY_TYPE_PLAYER);
|
|
uint16_t cameraPositionX, cameraPositionY;
|
|
if(player == NULL) {
|
|
cameraPositionX = 0;
|
|
cameraPositionY = 0;
|
|
} else {
|
|
cameraPositionX = player->x;
|
|
cameraPositionY = player->y;
|
|
}
|
|
|
|
drawMap(
|
|
GAME.currentMap,
|
|
cameraPositionX, cameraPositionY,
|
|
0, 0,
|
|
FRAME_WIDTH, FRAME_HEIGHT
|
|
);
|
|
|
|
// Draw UI
|
|
drawUITextbox();
|
|
} |