diff options
author | Ian C <ianc@noddybox.co.uk> | 2006-10-28 23:28:31 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2006-10-28 23:28:31 +0000 |
commit | 73a685f5a17852b6990c0810d0f1f0984c2c358f (patch) | |
tree | 2d6bed133b7c59b2787c544a153798c723c64d16 /arm9/source/gui.c | |
parent | 6fe1a8fd4735ce006d69cf8bb23df8f7adea7b41 (diff) |
Updates from work away
Diffstat (limited to 'arm9/source/gui.c')
-rw-r--r-- | arm9/source/gui.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arm9/source/gui.c b/arm9/source/gui.c index 91c7f8d..713ad02 100644 --- a/arm9/source/gui.c +++ b/arm9/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(); + } + } +} |