diff options
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -212,16 +212,31 @@ void updateGameStatus(Game* game) float width; float height; int fontSize = 20; - int lineCount = 2; - int maxColumns = 16; + int lineCount = 3; + int maxColumns = 24; float maxWidth = maxColumns * fontSize / 2.0; - bool topBarStyle = game->screen.destination.x < maxWidth; + bool topBarStyle = game->screen.destination.x < maxWidth / 2.0; const char* spacer = topBarStyle ? ", " : "\n"; + // Format text. + char placeAt[ENTITY_NAME_MAX] = "Back woods"; + WorldUID place = game->player.place; + + if (place != ENTITY_NONE) + { + strncpy(placeAt, getEntityName(game->world.entities[place].id), + ENTITY_NAME_MAX - 1); + } + const char* text = TextFormat( - "Speed %d kps%sPee level: 7", (int)roundf(game->player.speed), spacer); + "At: %s%sSpeed %d%sPee level: 7", + placeAt, + spacer, + (int)roundf(game->player.speed), + spacer); + // Handle bar style. if (topBarStyle) // Top bar style. { x = 110.0; @@ -237,6 +252,7 @@ void updateGameStatus(Game* game) height = fontSize * lineCount; } + // Draw text and background. Color backgroundColor = PINK; backgroundColor.a = game->settings.statusAndInfoAlpha; DrawRectangle(x, y, width, height, backgroundColor); |
