From b8cf331ff983c95d8641bae97137a8cc43d5266b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 22 Feb 2018 23:45:20 +1100 Subject: [PATCH] Fixed some warnings, theme should now be set based on the system theme --- common/common.h | 5 ++++- common/math.h | 4 ++++ common/menu.c | 6 ++---- nx_main/main.c | 4 +++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/common/common.h b/common/common.h index 9363c53..5d7bb4e 100644 --- a/common/common.h +++ b/common/common.h @@ -85,7 +85,10 @@ static inline void DrawPixelRaw(uint32_t x, uint32_t y, color_t clr) static inline color_t FetchPixelColor(uint32_t x, uint32_t y) { u32 off = (y * g_framebuf_width + x)*4; - return MakeColor(g_framebuf[off], g_framebuf[++off], g_framebuf[++off], 255); + u8 r = g_framebuf[off]; off++; + u8 g = g_framebuf[off]; off++; + u8 b = g_framebuf[off]; + return MakeColor(r, g, b, 255); } #else extern color_t pixels[720][1280]; diff --git a/common/math.h b/common/math.h index ab5c95e..7dd9f4f 100644 --- a/common/math.h +++ b/common/math.h @@ -6,4 +6,8 @@ float approxSin(float x); inline float clamp(float x, float min, float max) { return xmax ? max : x; +} + +inline float nxfabs(float x) { + return x < 0 ? -x : x; } \ No newline at end of file diff --git a/common/menu.c b/common/menu.c index eadd9d3..694532b 100644 --- a/common/menu.c +++ b/common/menu.c @@ -219,7 +219,7 @@ void drawWave(float timer, color_t color, float height, float phase, float speed new_color = waveBlendAdd(existing_color, color, clamp(alpha, 0.0, 1.0) * 0.3); } else if (alpha < 0.3) { // anti-aliasing - alpha = fabs(alpha); + alpha = nxfabs(alpha); new_color = MakeColor(color.r * (1.0 - alpha) + existing_color.r * alpha, color.g * (1.0 - alpha) + existing_color.g * alpha, color.b * (1.0 - alpha) + existing_color.b * alpha, 255); } else { // darken closer to bottom of the waves @@ -253,7 +253,6 @@ void menuLoop() { menuEntry_s* me; menu_s* menu = menuGetCurrent(); int i; - int cnt=0; int x, y; for (x=0; x<1280; x++) { @@ -290,8 +289,7 @@ void menuLoop() { // Draw menu entries for (me = menu->firstEntry, i = 0; me; me = me->next, i ++) { int entry_start_x = 29 + i * (140 + 30); - int entry_end_x = entry_start_x + 140; - + int screen_width = 1280; if (entry_start_x >= (screen_width - x)) break; diff --git a/nx_main/main.c b/nx_main/main.c index cedfbb3..fbacd1a 100644 --- a/nx_main/main.c +++ b/nx_main/main.c @@ -13,7 +13,9 @@ int main(int argc, char **argv) appletSetScreenShotPermission(1); - //themeStartup(); + ColorSetId theme; + setsysGetColorSetId(&theme); + themeStartup((ThemePreset)theme); menuStartup(); launchInit();