diff options
Diffstat (limited to 'source/gui.c')
-rw-r--r-- | source/gui.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/source/gui.c b/source/gui.c index 91c7f8d..713ad02 100644 --- a/source/gui.c +++ b/source/gui.c @@ -116,3 +116,76 @@ int GUI_Menu(const char *opts[]) return sel; } + +void GUI_Alert(int fatal, const char *text) +{ + char line[80]; + int h; + const char *p; + char *d; + + h=40; + p=text; + + while(*p) + { + if (*p++=='\n') + { + h+=8; + } + } + + FB_FillBox(0,0,SCREEN_WIDTH,h,FB_RGB(0,0,0)); + FB_Box(1,1,SCREEN_WIDTH-2,h-2,FB_RGB(31,0,0)); + + p=text; + h=4; + d=line; + + while(*p) + { + if (*p=='\n') + { + *d++=0; + p++; + FB_Centre(line,h,FB_RGB(31,31,31),-1); + h+=8; + d=line; + } + else + { + *d++=*p++; + } + } + + if (d>line) + { + *d=0; + FB_Centre(line,h,FB_RGB(31,31,31),-1); + h+=8; + } + + if (!fatal) + { + FB_Centre("PRESS ANY BUTTON OR SCREEN",h+16,FB_RGB(31,31,0),-1); + + while(!keysDown()) + { + swiWaitForVBlank(); + } + + while(keysHeld()) + { + swiWaitForVBlank(); + } + } + else + { + FB_Centre("PLEASE RESET YOUR CONSOLE",h+16,FB_RGB(31,31,0),-1); + + while(1) + { + swiWaitForVBlank(); + } + } +} |