summaryrefslogtreecommitdiff
path: root/arm9/source/gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/source/gui.c')
-rw-r--r--arm9/source/gui.c193
1 files changed, 0 insertions, 193 deletions
diff --git a/arm9/source/gui.c b/arm9/source/gui.c
deleted file mode 100644
index e505330..0000000
--- a/arm9/source/gui.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- ds81 - Nintendo DS ZX81 emulator.
-
- Copyright (C) 2006 Ian Cowburn <ianc@noddybox.co.uk>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- $Id$
-*/
-
-#include <nds.h>
-#include <string.h>
-
-#include "ds81_global.h"
-
-#include "framebuffer.h"
-
-
-/* ---------------------------------------- PUBLIC INTERFACES
-*/
-int GUI_Menu(const char *opts[])
-{
- int x,y;
- int h;
- int w;
- int no;
- int sel;
- int f;
- bool done;
- bool defer;
-
- w=0;
- h=0;
- sel=0;
- done=false;
- defer=false;
-
- for(no=0;opts[no];no++)
- {
- h+=16;
-
- if (strlen(opts[no])>w)
- {
- w=strlen(opts[no]);
- }
- }
-
- w=w*8+16;
-
- x=SCREEN_WIDTH/2-w/2;
- y=SCREEN_HEIGHT/2-h/2;
-
- while(!done)
- {
- uint32 key=0;
-
- FB_FillBox(x,y,w,h,FB_RGB(0,0,0));
- FB_Box(x,y,w,h,FB_RGB(31,31,31));
- FB_FillBox(x+1,y+sel*16+1,w-2,14,FB_RGB(8,8,31));
-
- for(f=0;f<no;f++)
- {
- FB_Centre(opts[f],y+4+f*16,FB_RGB(31,31,31),-1);
- }
-
- do
- {
- swiWaitForVBlank();
- } while(!defer && !(key=keysDownRepeat()));
-
- if (defer)
- {
- do
- {
- swiWaitForVBlank();
- } while (keysHeld()&KEY_TOUCH);
- done=true;
- }
- else
- {
- if (key & (KEY_A|KEY_B|KEY_X|KEY_Y))
- {
- done=true;
- }
- else if ((key & KEY_UP) && sel)
- {
- sel--;
- }
- else if ((key & KEY_DOWN) && sel<no-1)
- {
- sel++;
- }
- else if (key & KEY_TOUCH)
- {
- touchPosition tp=touchReadXY();
-
- if (tp.px>=x && tp.px<(w+w) && tp.py>=y && tp.py<(y+h))
- {
- defer=true;
- sel=(tp.py-y)/16;
- }
- }
- }
- }
-
- 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();
- }
- }
-}