display level names
This commit is contained in:
parent
d34c041657
commit
8126658a43
BIN
res/font.png
BIN
res/font.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
10
src/map.c
10
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue