54 lines
1.1 KiB
C
54 lines
1.1 KiB
C
/**
|
|
* Copyright (c) 2024 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "frame.h"
|
|
#include "game/game.h"
|
|
|
|
#include "display/draw/drawshape.h"
|
|
#include "display/draw/drawtext.h"
|
|
#include "display/draw/drawstateoverworld.h"
|
|
#include "display/draw/drawstatemainmenu.h"
|
|
#include "display/draw/drawbattle.h"
|
|
|
|
char_t FRAME_BUFFER[FRAME_HEIGHT * FRAME_WIDTH];
|
|
uint8_t FRAME_COLOR[FRAME_HEIGHT * FRAME_WIDTH];
|
|
|
|
void frameInit() {
|
|
drawClear(' ', COLOR_BLACK);
|
|
}
|
|
|
|
void frameUpdate() {
|
|
switch(GAME.state) {
|
|
case GAME_STATE_PAUSED:
|
|
const char_t *str = "PAUSED";
|
|
size_t len = strlen(str);
|
|
drawText(
|
|
str,
|
|
-1,
|
|
(FRAME_WIDTH - len) / 2,
|
|
(FRAME_HEIGHT - 1) / 2,
|
|
COLOR_WHITE
|
|
);
|
|
break;
|
|
|
|
case GAME_STATE_OVERWORLD:
|
|
drawStateOverworld();
|
|
break;
|
|
|
|
case GAME_STATE_MAIN_MENU:
|
|
drawStateMainMenu();
|
|
break;
|
|
|
|
case GAME_STATE_BATTLE:
|
|
drawBattle();
|
|
break;
|
|
|
|
default:
|
|
printf("Rendering unknown game state: %d\n", GAME.state);
|
|
break;
|
|
}
|
|
} |