diff options
| author | nathan <nathansmith@disroot.org> | 2026-01-07 07:28:35 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2026-01-07 07:28:35 +0000 |
| commit | 0fb94d28d3f64e95ff228edbfd8fc17d420e215f (patch) | |
| tree | 5a8103ad392cbb3df9b419a941f66050d1892f2b | |
| parent | e27d509615ca48c8b007f66349f554ce2a9758f9 (diff) | |
| download | FindThings-0fb94d28d3f64e95ff228edbfd8fc17d420e215f.tar.gz FindThings-0fb94d28d3f64e95ff228edbfd8fc17d420e215f.tar.bz2 FindThings-0fb94d28d3f64e95ff228edbfd8fc17d420e215f.zip | |
Status bar thingy going well
| -rw-r--r-- | src/game.c | 41 | ||||
| -rw-r--r-- | src/settings.c | 6 | ||||
| -rw-r--r-- | src/settings.h | 4 |
3 files changed, 42 insertions, 9 deletions
@@ -197,7 +197,7 @@ void updateGameEntityInfo(Game* game) } Color backgroundColor = PINK; - backgroundColor.a = game->settings.entityInfoAlpha; + backgroundColor.a = game->settings.statusAndInfoAlpha; DrawRectangle(x, y, screenWidth - x, lines * fontSize, backgroundColor); // Draw name. @@ -205,9 +205,42 @@ void updateGameEntityInfo(Game* game) DrawText(getEntityName(selectedEntity->id), x, y, fontSize, BLACK); } -void updateGameTopStatus(Game* game) +void updateGameStatus(Game* game) { - DrawText(TextFormat("Speed %.2f", game->player.speed), 150.0, 1.0, 20, GREEN); + float x; + float y; + float width; + float height; + int fontSize = 20; + int lineCount = 2; + int maxColumns = 16; + float maxWidth = maxColumns * fontSize / 2.0; + bool topBarStyle = game->screen.destination.x < maxWidth; + + const char* spacer = topBarStyle ? ", " : "\n"; + + const char* text = TextFormat( + "Speed %d kps%sPee level: 7", (int)roundf(game->player.speed), spacer); + + if (topBarStyle) // Top bar style. + { + x = 110.0; + y = 1.0; + width = (getStringLength(text, 255) + 1) * fontSize / 2.0; + height = fontSize; + } + else // Side bar style. + { + x = 1.0; + y = game->showFPS ? 20.0 : 0.0; + width = maxWidth; + height = fontSize * lineCount; + } + + Color backgroundColor = PINK; + backgroundColor.a = game->settings.statusAndInfoAlpha; + DrawRectangle(x, y, width, height, backgroundColor); + DrawText(text, x, y, fontSize, BLACK); } void updateGameScene(Game* game) @@ -272,7 +305,7 @@ void updateGameScene(Game* game) updateMap(&game->map, game); updateGameEntityInfo(game); - updateGameTopStatus(game); + updateGameStatus(game); updateInteractionChat(&game->interactionChat, game); updateInteractionMenu(&game->interactionMenu, game); } diff --git a/src/settings.c b/src/settings.c index 848eea1..ee126b4 100644 --- a/src/settings.c +++ b/src/settings.c @@ -25,8 +25,8 @@ Settings defaultSettings() .crossHairColor = BLUE, .isBobbleEnabled = true, .bobbleRate = 1.0, - .bobbleAmount = 0.07, - .playerAcceleration = 9.0, + .bobbleAmount = 0.083, + .playerAcceleration = 7.0, .isMapPreviewEnabledDefault = true, .mapPreviewWidth = 300.0, .mapPreviewHeight = 300.0, @@ -37,7 +37,7 @@ Settings defaultSettings() .mapColorCount = 7.0, .mapZoomSpeed = 0.2, .entityInfoFontSize = 20, - .entityInfoAlpha = (unsigned char)255.0 * 0.8, + .statusAndInfoAlpha = (unsigned char)255.0 * 0.8, .interactionFontSize = 20, .interactionAlpha = (unsigned char)255.0 * 0.9, .interactionOutlineSize = 2.0, diff --git a/src/settings.h b/src/settings.h index a59b36a..b64c631 100644 --- a/src/settings.h +++ b/src/settings.h @@ -55,9 +55,9 @@ typedef struct { float mapColorCount; float mapZoomSpeed; - // Side info. + // Side info and status. int entityInfoFontSize; - unsigned char entityInfoAlpha; + unsigned char statusAndInfoAlpha; // Interaction chat and menu. int interactionFontSize; |
