summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-21 22:19:31 +0100
committerkdx <kikoodx@paranoici.org>2023-03-21 22:19:31 +0100
commit8126658a4339802fe040fb7be368711b533033cd (patch)
treedc175145293da1182afb91beabc3fa8d84a53374
parentd34c04165707874881f1d19416a1da0d39a2250a (diff)
downloadhyperultra-8126658a4339802fe040fb7be368711b533033cd.tar.gz
display level names
-rw-r--r--res/font.pngbin1490 -> 2359 bytes
-rw-r--r--src/game.c4
-rw-r--r--src/game.h1
-rw-r--r--src/main.c2
-rw-r--r--src/map.c10
-rw-r--r--src/map.h1
6 files changed, 17 insertions, 1 deletions
diff --git a/res/font.png b/res/font.png
index 929528d..dd796e3 100644
--- a/res/font.png
+++ b/res/font.png
Binary files differ
diff --git a/src/game.c b/src/game.c
index 31ac01b..40319d5 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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;
diff --git a/src/game.h b/src/game.h
index b8dae9f..2127fb9 100644
--- a/src/game.h
+++ b/src/game.h
@@ -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;
diff --git a/src/main.c b/src/main.c
index ff69d98..afc124f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,8 +32,8 @@ int main(void)
LZY_DrawBegin();
LZY_DrawSetColor(WHITE);
LZY_DrawClear();
- background_draw();
game_draw(game);
+ background_draw();
LZY_DrawEnd();
}
diff --git a/src/map.c b/src/map.c
index dc0826d..c31eb66 100644
--- a/src/map.c
+++ b/src/map.c
@@ -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);
+}
diff --git a/src/map.h b/src/map.h
index b5bbfc6..d305d13 100644
--- a/src/map.h
+++ b/src/map.h
@@ -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);