diff options
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -152,6 +152,38 @@ void drawCrosshair(float crossHairSize, float crossHairThickness, Color color) crossHairThickness, color); } +void updateGameEntityInfo(Game* game) +{ + // Get size. + float screenWidth = GetRenderWidth(); + float screenHeight = GetRenderWidth(); + float x = game->map.rect.x + (game->map.rect.width * 0.25); + float y = game->map.rect.y + game->map.rect.height; + + int lines = 1; + int fontSize = game->settings.entityInfoFontSize; + + if (!game->map.isEnabled) + { + y = 0.0; + } + + WorldUID selected = game->player.selectedEntity; + + if (selected == ENTITY_NONE) + { + return; + } + + Color backgroundColor = PINK; + backgroundColor.a = game->settings.entityInfoAlpha; + DrawRectangle(x, y, screenWidth - x, lines * fontSize, backgroundColor); + + // Draw name. + Entity* selectedEntity = &game->world.entities[selected]; + DrawText(getEntityName(selectedEntity->id), x, y, fontSize, BLACK); +} + void updateGameScene(Game* game) { // Handle toggle cursor. @@ -189,6 +221,7 @@ void updateGameScene(Game* game) drawGameScreen(game); updateMap(&game->map, game); + updateGameEntityInfo(game); updateInteractionChat(&game->chat, game); // Cross hair. |
