aboutsummaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index d8823d2..b2f2d32 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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.