diff options
author | Ian C <ianc@noddybox.co.uk> | 2003-12-23 23:30:39 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2003-12-23 23:30:39 +0000 |
commit | 991bd20ca8f627169c7648202e0258b15e3b43fb (patch) | |
tree | 048a48796dd0a78deee6d58d41f40fb329a63882 /src | |
parent | 694155dda64f2aa7c89f6fa510ea458e18c778fd (diff) |
Tweaked GUI to preallocate colours
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 132 | ||||
-rw-r--r-- | src/gui.c | 49 | ||||
-rw-r--r-- | src/zx81.c | 4 | ||||
-rw-r--r-- | src/zx81.h | 4 |
4 files changed, 170 insertions, 19 deletions
diff --git a/src/Makefile b/src/Makefile index 0a924d7..96ed1c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.6 2003-12-22 23:31:04 ianc Exp $ +# $Id: Makefile,v 1.7 2003-12-23 23:30:39 ianc Exp $ # @@ -69,3 +69,133 @@ depend: cd z80; make depend ; cd .. # DO NOT DELETE THIS LINE -- make depend depends on it + +main.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +main.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +main.o: /usr/include/stdio.h /usr/local/include/SDL/SDL.h +main.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h +main.o: /usr/local/include/SDL/SDL_getenv.h +main.o: /usr/local/include/SDL/SDL_error.h +main.o: /usr/local/include/SDL/begin_code.h +main.o: /usr/local/include/SDL/close_code.h +main.o: /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h +main.o: /usr/local/include/SDL/SDL_audio.h +main.o: /usr/local/include/SDL/SDL_byteorder.h +main.o: /usr/local/include/SDL/SDL_cdrom.h +main.o: /usr/local/include/SDL/SDL_joystick.h +main.o: /usr/local/include/SDL/SDL_events.h +main.o: /usr/local/include/SDL/SDL_active.h +main.o: /usr/local/include/SDL/SDL_keyboard.h +main.o: /usr/local/include/SDL/SDL_keysym.h +main.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h +main.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h +main.o: /usr/local/include/SDL/SDL_version.h z80/z80.h zx81.h gfx.h gui.h +main.o: memmenu.h config.h exit.h +zx81.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +zx81.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +zx81.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h +zx81.o: zx81.h z80/z80.h /usr/local/include/SDL/SDL.h +zx81.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h +zx81.o: /usr/local/include/SDL/SDL_getenv.h +zx81.o: /usr/local/include/SDL/SDL_error.h +zx81.o: /usr/local/include/SDL/begin_code.h +zx81.o: /usr/local/include/SDL/close_code.h +zx81.o: /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h +zx81.o: /usr/local/include/SDL/SDL_audio.h +zx81.o: /usr/local/include/SDL/SDL_byteorder.h +zx81.o: /usr/local/include/SDL/SDL_cdrom.h +zx81.o: /usr/local/include/SDL/SDL_joystick.h +zx81.o: /usr/local/include/SDL/SDL_events.h +zx81.o: /usr/local/include/SDL/SDL_active.h +zx81.o: /usr/local/include/SDL/SDL_keyboard.h +zx81.o: /usr/local/include/SDL/SDL_keysym.h +zx81.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h +zx81.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h +zx81.o: /usr/local/include/SDL/SDL_version.h gfx.h gui.h config.h exit.h +config.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +config.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +config.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h +config.o: exit.h config.h +gfx.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +gfx.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +gfx.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h +gfx.o: /usr/include/stdarg.h gfx.h /usr/local/include/SDL/SDL.h +gfx.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h +gfx.o: /usr/local/include/SDL/SDL_getenv.h /usr/local/include/SDL/SDL_error.h +gfx.o: /usr/local/include/SDL/begin_code.h +gfx.o: /usr/local/include/SDL/close_code.h /usr/local/include/SDL/SDL_rwops.h +gfx.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h +gfx.o: /usr/local/include/SDL/SDL_byteorder.h +gfx.o: /usr/local/include/SDL/SDL_cdrom.h +gfx.o: /usr/local/include/SDL/SDL_joystick.h +gfx.o: /usr/local/include/SDL/SDL_events.h +gfx.o: /usr/local/include/SDL/SDL_active.h +gfx.o: /usr/local/include/SDL/SDL_keyboard.h +gfx.o: /usr/local/include/SDL/SDL_keysym.h /usr/local/include/SDL/SDL_mouse.h +gfx.o: /usr/local/include/SDL/SDL_video.h /usr/local/include/SDL/SDL_mutex.h +gfx.o: /usr/local/include/SDL/SDL_quit.h /usr/local/include/SDL/SDL_version.h +gfx.o: exit.h config.h font.h +gui.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +gui.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +gui.o: /usr/include/stdio.h /usr/include/string.h /usr/include/strings.h +gui.o: /usr/include/stdarg.h /usr/include/ctype.h /usr/include/runetype.h +gui.o: gui.h /usr/local/include/SDL/SDL.h /usr/local/include/SDL/SDL_main.h +gui.o: /usr/local/include/SDL/SDL_types.h /usr/local/include/SDL/SDL_getenv.h +gui.o: /usr/local/include/SDL/SDL_error.h /usr/local/include/SDL/begin_code.h +gui.o: /usr/local/include/SDL/close_code.h /usr/local/include/SDL/SDL_rwops.h +gui.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h +gui.o: /usr/local/include/SDL/SDL_byteorder.h +gui.o: /usr/local/include/SDL/SDL_cdrom.h +gui.o: /usr/local/include/SDL/SDL_joystick.h +gui.o: /usr/local/include/SDL/SDL_events.h +gui.o: /usr/local/include/SDL/SDL_active.h +gui.o: /usr/local/include/SDL/SDL_keyboard.h +gui.o: /usr/local/include/SDL/SDL_keysym.h /usr/local/include/SDL/SDL_mouse.h +gui.o: /usr/local/include/SDL/SDL_video.h /usr/local/include/SDL/SDL_mutex.h +gui.o: /usr/local/include/SDL/SDL_quit.h /usr/local/include/SDL/SDL_version.h +gui.o: gfx.h exit.h +memmenu.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +memmenu.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +memmenu.o: /usr/include/string.h /usr/include/strings.h memmenu.h z80/z80.h +memmenu.o: zx81.h /usr/local/include/SDL/SDL.h +memmenu.o: /usr/local/include/SDL/SDL_main.h +memmenu.o: /usr/local/include/SDL/SDL_types.h +memmenu.o: /usr/local/include/SDL/SDL_getenv.h +memmenu.o: /usr/local/include/SDL/SDL_error.h +memmenu.o: /usr/local/include/SDL/begin_code.h +memmenu.o: /usr/local/include/SDL/close_code.h +memmenu.o: /usr/local/include/SDL/SDL_rwops.h /usr/include/stdio.h +memmenu.o: /usr/local/include/SDL/SDL_timer.h +memmenu.o: /usr/local/include/SDL/SDL_audio.h +memmenu.o: /usr/local/include/SDL/SDL_byteorder.h +memmenu.o: /usr/local/include/SDL/SDL_cdrom.h +memmenu.o: /usr/local/include/SDL/SDL_joystick.h +memmenu.o: /usr/local/include/SDL/SDL_events.h +memmenu.o: /usr/local/include/SDL/SDL_active.h +memmenu.o: /usr/local/include/SDL/SDL_keyboard.h +memmenu.o: /usr/local/include/SDL/SDL_keysym.h +memmenu.o: /usr/local/include/SDL/SDL_mouse.h +memmenu.o: /usr/local/include/SDL/SDL_video.h +memmenu.o: /usr/local/include/SDL/SDL_mutex.h +memmenu.o: /usr/local/include/SDL/SDL_quit.h +memmenu.o: /usr/local/include/SDL/SDL_version.h gfx.h gui.h +exit.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h +exit.o: /usr/include/sys/_types.h /usr/include/machine/_types.h +exit.o: /usr/include/stdarg.h exit.h /usr/local/include/SDL/SDL.h +exit.o: /usr/local/include/SDL/SDL_main.h /usr/local/include/SDL/SDL_types.h +exit.o: /usr/local/include/SDL/SDL_getenv.h +exit.o: /usr/local/include/SDL/SDL_error.h +exit.o: /usr/local/include/SDL/begin_code.h +exit.o: /usr/local/include/SDL/close_code.h +exit.o: /usr/local/include/SDL/SDL_rwops.h /usr/include/stdio.h +exit.o: /usr/local/include/SDL/SDL_timer.h /usr/local/include/SDL/SDL_audio.h +exit.o: /usr/local/include/SDL/SDL_byteorder.h +exit.o: /usr/local/include/SDL/SDL_cdrom.h +exit.o: /usr/local/include/SDL/SDL_joystick.h +exit.o: /usr/local/include/SDL/SDL_events.h +exit.o: /usr/local/include/SDL/SDL_active.h +exit.o: /usr/local/include/SDL/SDL_keyboard.h +exit.o: /usr/local/include/SDL/SDL_keysym.h +exit.o: /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h +exit.o: /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h +exit.o: /usr/local/include/SDL/SDL_version.h @@ -55,10 +55,30 @@ static const char ident_h[]=EZX81_GUI_H; /* ---------------------------------------- STATICS */ +static Uint32 white; +static Uint32 black; +static Uint32 pale; +static Uint32 red; /* ---------------------------------------- PRIVATE FUNCTIONS */ +static void Init() +{ + static int init=FALSE; + + if (init) + return; + + init=TRUE; + + white=GFXRGB(255,255,255); + black=GFXRGB(0,0,0); + pale=GFXRGB(200,200,200); + red=GFXRGB(255,100,100); +} + + static void *Malloc(size_t size) { void *p=malloc(size); @@ -70,9 +90,9 @@ static void *Malloc(size_t size) } -static void Centre(const char *p, int y, int r, int g, int b) +static void Centre(const char *p, int y, Uint32 col) { - GFXPrint((SCR_W-strlen(p)*8)/2,y,GFXRGB(r,g,b),"%s",p); + GFXPrint((SCR_W-strlen(p)*8)/2,y,col,"%s",p); } @@ -90,6 +110,8 @@ void GUIMessage(const char *title, const char *format,...) int height; int x,y; + Init(); + va_start(va,format); vsprintf(buff,format,va); va_end(va); @@ -130,21 +152,16 @@ void GUIMessage(const char *title, const char *format,...) y=(SCR_H-height)/2; x=(SCR_W-width)/2; - GFXRect(x-1,y-1, - width+2,height+2, - GFXRGB(255,255,255),FALSE); + GFXRect(x-1,y-1,width+2,height+2,white,FALSE); + GFXRect(x,y,width,height,black,TRUE); - GFXRect(x,y, - width,height, - GFXRGB(0,0,0),TRUE); - - Centre(title,y+2,255,255,255); - GFXHLine(x+2,x+width-4,y+10,GFXRGB(255,255,255)); + Centre(title,y+2,white); + GFXHLine(x+2,x+width-4,y+10,white); for(f=0;f<no;f++) - Centre(line[f],y+5+10*(f+1),200,200,200); + Centre(line[f],y+5+10*(f+1),pale); - Centre("Press a key",y+height-10,255,0,0); + Centre("Press a key",y+height-10,red); GFXEndFrame(FALSE); @@ -162,14 +179,16 @@ const char *GUIInputString(const char *prompt, const char *orig) int done=FALSE; SDL_Event *e; + Init(); + buff[0]=0; strncat(buff,orig,40); len=strlen(buff); while(!done) { - GFXRect(0,y_pos,SCR_W,8,GFXRGB(0,0,0),TRUE); - GFXPrint(0,y_pos,GFXRGB(255,255,255),"%s %s%c",prompt,buff,FONT_CURSOR); + GFXRect(0,y_pos,SCR_W,8,black,TRUE); + GFXPrint(0,y_pos,white,"%s %s%c",prompt,buff,FONT_CURSOR); GFXEndFrame(FALSE); e=GFXWaitKey(); @@ -34,7 +34,7 @@ static const char ident[]="$Id$"; #include "config.h" #include "exit.h" -static const char ident_h[]=EZX81ZX81H; +static const char ident_h[]=EZX81_ZX81H; #ifndef TRUE #define TRUE 1 @@ -401,9 +401,11 @@ static int CheckTimers(Z80 *z80, Z80Val val) if (nmigen) { Z80NMI(z80,0xff); + printf("NMIGEN\n"); } else if (hsync) { + printf("HSYNC\n"); if (ULA.release) { /* ULA.release=FALSE; */ @@ -24,8 +24,8 @@ */ -#ifndef EZX81ZX81H -#define EZX81ZX81H "$Id$" +#ifndef EZX81_ZX81H +#define EZX81_ZX81H "$Id$" #include "z80.h" #include "SDL.h" |