From af74e37b4cb213a1cacdc3c89ae9ad04e34b916e Mon Sep 17 00:00:00 2001 From: KiritoDev Date: Sun, 20 Jun 2021 12:31:44 -0500 Subject: [PATCH] Reimplemented switch battery hud --- src/game/hud.c | 22 +++++++++++----------- src/pc/controller/controller_sdl.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/hud.c b/src/game/hud.c index 05bafeb6..86233d3e 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -441,19 +441,19 @@ void render_hud_camera_status(void) { #ifdef TARGET_SWITCH +#define COLOR(r, g, b) (struct Color) {r, g, b, 255} + void render_nx_hud(void){ s16 x = 40; - s16 y = 212; - s16 w = x + 12; - s16 h = y + 4; - struct Color color; - //color = { .r = 57, .g = 57, .b = 57, .a = 255 } - //moon_draw_rectangle(x - 1, y - 1, w + 1, h + 1, COLOR(57, 57, 57, 255)); - //moon_draw_rectangle(w, y, w + 2, y + 4, color); - //color = { .r = 57, .g = 57, .b = 57, .a = 255 } - //moon_draw_rectangle(x, y, w, h, COLOR(194, 194, 194, 255)); - //color = { .r = 57, .g = 57, .b = 57, .a = 255 } - //moon_draw_rectangle(x, y, x + (s16)(12 * getBatteryPercentage()), h, COLOR(78, 235, 52, 255)); + float y = 212.5; + s16 w = 12; + s16 h = 6; + float battery = getBatteryPercentage(); + + moon_draw_rectangle(x - 1, y - 1, w + 2, h + 1, COLOR(57, 57, 57), false); + moon_draw_rectangle(x + w, y + 0.5, 2, 4, COLOR(57, 57, 57), false); + moon_draw_rectangle(x, y, w, h - 1, COLOR(194, 194, 194), false); + moon_draw_rectangle(x, y, (w * battery), h - 1, COLOR(76, 235, 52), false); x = GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(20); y = 207; diff --git a/src/pc/controller/controller_sdl.c b/src/pc/controller/controller_sdl.c index baaea648..9107ab5d 100644 --- a/src/pc/controller/controller_sdl.c +++ b/src/pc/controller/controller_sdl.c @@ -109,7 +109,7 @@ static void controller_sdl_init(void) { if (rw) { int nummaps = SDL_GameControllerAddMappingsFromRW(rw, SDL_TRUE); if (nummaps >= 0) - printf("loaded %d controller mappings from 'db/gamecontrollerdb.txt'\n", nummaps); + printf("[Moon64 - SDL] Loaded %d controller mappings\n", nummaps); } } #endif