summaryrefslogtreecommitdiff
path: root/src/gfx.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2004-01-22 02:38:13 +0000
committerIan C <ianc@noddybox.co.uk>2004-01-22 02:38:13 +0000
commit2fc6cc22a29a53dc5127eafa2719d11e9bb38c42 (patch)
treed7e1c1ff902b2cb6469355c1750f1e93f42d1155 /src/gfx.c
parentfc438b5afe5b6126d5cae3dd3586e608bc7a4925 (diff)
Updated with various bits from espec (memory menu, GUI, etc)
Diffstat (limited to 'src/gfx.c')
-rw-r--r--src/gfx.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/gfx.c b/src/gfx.c
index e7cecb8..ab7768c 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -50,9 +50,6 @@ static const char ident_fh[]=EZX81_FONT_H;
#define FALSE 0
#endif
-#define SCR_W 320
-#define SCR_H 200
-
#define LOCK do \
{ \
if (SDL_MUSTLOCK(surface)) \
@@ -171,8 +168,8 @@ void GFXInit(void)
if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO))
Exit("Failed to init SDL: %s\n",SDL_GetError());
- if (!(surface=SDL_SetVideoMode(SCR_W*scale,
- SCR_H*scale,
+ if (!(surface=SDL_SetVideoMode(GFX_WIDTH*scale,
+ GFX_HEIGHT*scale,
0,
IConfig(CONF_FULLSCREEN) ?
SDL_FULLSCREEN : 0)))
@@ -182,6 +179,8 @@ void GFXInit(void)
SDL_ShowCursor(SDL_DISABLE);
SDL_WM_SetCaption("eZX81","eZX81");
+
+ atexit(SDL_Quit);
}
@@ -262,6 +261,18 @@ SDL_Event *GFXWaitKey(void)
}
+void GFXLock(void)
+{
+ LOCK;
+}
+
+
+void GFXUnlock(void)
+{
+ UNLOCK;
+}
+
+
void GFXPlot(int x, int y, Uint32 col)
{
LOCK;
@@ -272,6 +283,12 @@ void GFXPlot(int x, int y, Uint32 col)
}
+void GFXFastPlot(int x, int y, Uint32 col)
+{
+ putpixel(x,y,col);
+}
+
+
void GFXRect(int x, int y, int w, int h, Uint32 col, int solid)
{
LOCK;
@@ -334,11 +351,11 @@ void GFXPrint(int x, int y, Uint32 col, const char *format, ...)
{
for(sy=0;sy<8;sy++)
{
- if (y+sy<SCR_H && x<SCR_W)
+ if (y+sy<GFX_HEIGHT && x<GFX_WIDTH)
{
for(sx=0;sx<8;sx++)
{
- if (font[(int)*p][sx+sy*8] && x+sx<SCR_W)
+ if (font[(int)*p][sx+sy*8] && x+sx<GFX_WIDTH)
putpixel(x+sx,y+sy,col);
}
}
@@ -372,11 +389,11 @@ void GFXPrintPaper(int x, int y, Uint32 col, Uint32 paper,
{
for(sy=0;sy<8;sy++)
{
- if (y+sy<SCR_H && x<SCR_W)
+ if (y+sy<GFX_HEIGHT && x<GFX_WIDTH)
{
for(sx=0;sx<8;sx++)
{
- if (font[(int)*p][sx+sy*8] && x+sx<SCR_W)
+ if (font[(int)*p][sx+sy*8] && x+sx<GFX_WIDTH)
putpixel(x+sx,y+sy,col);
else
putpixel(x+sx,y+sy,paper);