diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-21 22:19:31 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-21 22:19:31 +0100 |
commit | 8126658a4339802fe040fb7be368711b533033cd (patch) | |
tree | dc175145293da1182afb91beabc3fa8d84a53374 | |
parent | d34c04165707874881f1d19416a1da0d39a2250a (diff) | |
download | hyperultra-8126658a4339802fe040fb7be368711b533033cd.tar.gz |
display level names
-rw-r--r-- | res/font.png | bin | 1490 -> 2359 bytes | |||
-rw-r--r-- | src/game.c | 4 | ||||
-rw-r--r-- | src/game.h | 1 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/map.c | 10 | ||||
-rw-r--r-- | src/map.h | 1 |
6 files changed, 17 insertions, 1 deletions
diff --git a/res/font.png b/res/font.png Binary files differindex 929528d..dd796e3 100644 --- a/res/font.png +++ b/res/font.png @@ -41,6 +41,7 @@ game_update(Game *this) if (e->type != ET_NONE && e->update != NULL) e->update(e, this); } + this->show_ui -= (this->show_ui > 0); } void @@ -52,12 +53,15 @@ game_draw(Game *this) if (e->type != ET_NONE && e->draw != NULL) e->draw(e, this); } + if (this->show_ui) + map_draw_ui(); } void game_restart_scene(Game *this) { memset(this->entities, 0, sizeof(this->entities)); + this->show_ui = 30; for (int y = 0; y < map_height(); y++) for (int x = 0; x < map_width(); x++) { const int dx = x * TSIZE + TSIZE / 2; @@ -8,6 +8,7 @@ typedef struct Game { bool queue_next_scene; int queue_restart_scene; int player_dir; + int show_ui; double spike_angle; Entity entities[MAX_ENTITIES]; } Game; @@ -32,8 +32,8 @@ int main(void) LZY_DrawBegin(); LZY_DrawSetColor(WHITE); LZY_DrawClear(); - background_draw(); game_draw(game); + background_draw(); LZY_DrawEnd(); } @@ -70,8 +70,18 @@ draw_outline(int x, int y) void map_draw(void) { + LZY_DrawSetColor(BLACK); for (int y = 0; y < map_height(); y++) for (int x = 0; x < map_width(); x++) if (map_get(x, y) == 1) draw_outline(x, y); } + +void +map_draw_ui(void) +{ + const char *s = (char *)maps[1 + map_id]; + const int x = (DISPLAY_WIDTH - CHR_WIDTH * strlen(s)) / 2; + const int y = (DISPLAY_HEIGHT - CHR_HEIGHT) / 2; + LZY_DrawText(x, y, s); +} @@ -6,3 +6,4 @@ int map_height(void); int map_get(int x, int y); int map_get_px(int x, int y); void map_draw(void); +void map_draw_ui(void); |