crocparty/game/game.c
2024-02-28 20:48:22 -08:00

59 lines
1.0 KiB
C

#include "art/game_player.h"
#include "art/game_tiles.h"
#include "device/device.h"
#include "map/game_map.h"
#include "game.h"
#include "sys/sys.h"
#include <stdio.h>
uint32_t game_frame;
const char* game_title() {
return "Croc Party!";
}
void game_init() {
sys_init();
map_game_map_create_entities();
game_palette_init();
game_player_init();
}
void game_destroy() {
sys_destroy();
}
void game_update() {
sys_update();
game_frame += 1;
bool allow_input = true;
if (sys_btn(DEVICE_BUTTON_2)) {
game_dialogue_display("Hello, world!\nYou rock.");
}
game_collectibles_update();
game_npcs_update();
game_dialogue_update(&allow_input);
game_player_update(&allow_input);
}
void game_draw() {
sys_cls(9);
game_player_set_camera();
sys_map_draw(map_game_map, spr_game_tiles, 0, 0, 0, 0, map_game_map.width, map_game_map.height);
game_collectibles_draw();
game_npcs_draw();
game_player_draw();
sys_camera_reset();
game_dialogue_draw();
}