From 539e95253ce1bc6860ca4ea658a8afb80412aefd Mon Sep 17 00:00:00 2001 From: ZetaDesigns Date: Tue, 5 Sep 2017 21:31:50 +0200 Subject: [PATCH] finish up basic errorcode functions --- include/common.h | 2 ++ include/draw.h | 2 +- source/draw.c | 14 +++++++++++--- source/main.c | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/common.h b/include/common.h index 6955dbe..79f284d 100644 --- a/include/common.h +++ b/include/common.h @@ -41,6 +41,8 @@ #define BGM_INSTALL 2 #define UNINSTALL 3 +#define ERROR 0 +#define WARNING 1 static const int THEMES_PER_SCREEN = 4; enum TextureID { diff --git a/include/draw.h b/include/draw.h index dbedd80..eb4e60b 100644 --- a/include/draw.h +++ b/include/draw.h @@ -40,5 +40,5 @@ void draw_theme_install(int install_type); void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_theme, bool preview_mode, int shuffle_theme_count); void draw_splash_install(int install_type); void draw_splash_interface(Splash_s *splashes_list, int splash_count, int selected_splash, bool preview_mode); -void throw_error(char* error); +void throw_error(char* error, int error_type); #endif \ No newline at end of file diff --git a/source/draw.c b/source/draw.c index 27ad87a..2ee5c23 100644 --- a/source/draw.c +++ b/source/draw.c @@ -37,7 +37,8 @@ enum Colors { COLOR_WHITE = RGBA8(255, 255, 255, 255), COLOR_CURSOR = RGBA8(200, 200, 200, 255), COLOR_BLACK = RGBA8(0, 0, 0, 255), - COLOR_RED = RGBA8(200, 0, 0, 255) + COLOR_RED = RGBA8(200, 0, 0, 255), + COLOR_YELLOW = RGBA8(239, 220, 11, 255), }; void init_screens(void) @@ -143,9 +144,16 @@ void draw_base_interface(void) pp2d_draw_text(7, 219, 0.6, 0.6, COLOR_WHITE, VERSION); pp2d_draw_on(GFX_TOP); } -void throw_error(char* error) { +void throw_error(char* error, int error_type) { draw_base_interface(); - pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_WHITE, error); + switch (error_type) { + case ERROR: + pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_RED, error); + break; + case WARNING: + pp2d_draw_text(70, 120, 0.8, 0.8, COLOR_YELLOW, error); + break; + } pp2d_end_draw(); } void draw_theme_install(int install_type) diff --git a/source/main.c b/source/main.c index 2fda57d..c43e987 100644 --- a/source/main.c +++ b/source/main.c @@ -122,7 +122,7 @@ int main(void) } else if (kDown & KEY_L) { - throw_error("TEST"); + splash_mode = !splash_mode; } else if (kDown & KEY_R) { if (splash_mode || preview_mode) {