Re: [Tuxnes-devel] Trying to add SDL Renderer
Brought to you by:
tmmm
From: W. M. P. <mi...@fl...> - 2002-03-10 13:45:04
|
> I'm trying to add an SDL renderer to tuxnes. Eventually this will give > us full-screen support and additional platforms for free. > [...] I have the basic renderer working, though I don't really understand tuxnes's color code (UpdateColor.* functions). As I understand it, the NES is only able to display 24 colors at once. Because of this, the emulator's palette must be updated to the appropriate colors for each frame and these colors have to be mapped to a display's 8-, 16-, 24-, or 32-bit colorspace. I am just confused how x11.c, w.c, and ggi.c are accomplishing this. Enclosed is my SDL patch thus far. It has a severely broken sdl.c:UpdateColorsSDL function. Could someone please enlighten me on how tuxnes's color code works? Thanks. ================================================================================ diff -u --new-file --recursive tuxnes-0.75-vanilla/Makefile.am tuxnes-0.75/Makefile.am --- tuxnes-0.75-vanilla/Makefile.am Mon Apr 16 14:43:25 2001 +++ tuxnes-0.75/Makefile.am Sat Mar 9 10:42:48 2002 @@ -5,7 +5,7 @@ noinst_PROGRAMS = comptbl tuxnes_SOURCES = x86.S d6502.c dynrec.c emu.c fb.c gamegenie.c io.c mapper.c \ - sound.c sound.h ggi.c x11.c w.c consts.h gamegenie.h globals.h \ + sdl.c sound.c sound.h ggi.c x11.c w.c consts.h gamegenie.h globals.h \ mapper.h renderer.c renderer.h ntsc_pal.c unzip.c unzip.h \ ziploader.c ziploader.h EXTRA_tuxnes_SOURCES = pixels.h diff -u --new-file --recursive tuxnes-0.75-vanilla/config.h.in tuxnes-0.75/config.h.in --- tuxnes-0.75-vanilla/config.h.in Tue Mar 27 03:11:27 2001 +++ tuxnes-0.75/config.h.in Sat Mar 9 10:11:44 2002 @@ -1,153 +1,195 @@ /* config.h.in. Generated automatically from configure.in by autoheader. */ +/* + * `autoheader' will generate config.h.in for TuxNES + * + * Original by (probably) Mike + * + * BSD extensions by Jeroen Ruigrok van der Werven + * + * $Id: acconfig.h,v 1.4 1999/11/06 13:51:19 asmodai Exp $ + */ -/* Define to empty if the keyword does not work. */ +/* Package name of TuxNES */ +#undef PACKAGE + +/* Version of TuxNES */ +#undef VERSION + +/* Define if you have the gnugetopt library */ +#undef HAVE_LIBGNUGETOPT + +/* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP +/* Define if you have the <dirent.h> header file, and it defines `DIR'. */ +#undef HAVE_DIRENT_H -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE +/* Define if you have the <features.h> header file. */ +#undef HAVE_FEATURES_H -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t +/* Define if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Define if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME +/* Define if you have the <ggi/ggi.h> header file. */ +#undef HAVE_GGI_GGI_H -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define if you have the <ggi/gii.h> header file. */ +#undef HAVE_GGI_GII_H -/* Define if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING +/* Define if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H -/* Define if you have the gnugetopt library */ -#undef HAVE_LIBGNUGETOPT +/* Define if you have the `ggi' library (-lggi). */ +#undef HAVE_LIBGGI -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE +/* Define if you have the `gii' library (-lgii). */ +#undef HAVE_LIBGII -/* Define if you have the gettimeofday function. */ -#undef HAVE_GETTIMEOFDAY +/* Define if you have the `m' library (-lm). */ +#undef HAVE_LIBM -/* Define if you have the strtod function. */ -#undef HAVE_STRTOD +/* Define if you have the `pbm' library (-lpbm). */ +#undef HAVE_LIBPBM -/* Define if you have the strtoul function. */ -#undef HAVE_STRTOUL +/* Define if you have the `pgm' library (-lpgm). */ +#undef HAVE_LIBPGM -/* Define if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H +/* Define if you have the `ppm' library (-lppm). */ +#undef HAVE_LIBPPM -/* Define if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H +/* Define if you have the `SDL' library (-lSDL). */ +#undef HAVE_LIBSDL -/* Define if you have the <features.h> header file. */ -#undef HAVE_FEATURES_H +/* Define if you have the `snss' library (-lsnss). */ +#undef HAVE_LIBSNSS -/* Define if you have the <ggi/ggi.h> header file. */ -#undef HAVE_GGI_GGI_H +/* Define if you have the `W' library (-lW). */ +#undef HAVE_LIBW -/* Define if you have the <ggi/gii.h> header file. */ -#undef HAVE_GGI_GII_H +/* Define if you have the `Xext' library (-lXext). */ +#undef HAVE_LIBXEXT + +/* Define if you have the `Xpm' library (-lXpm). */ +#undef HAVE_LIBXPM -/* Define if you have the <linux/joystick.h> header file. */ +/* Define if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + +/* Define if you have the <linux/joystick.h> header file. */ #undef HAVE_LINUX_JOYSTICK_H -/* Define if you have the <linux/soundcard.h> header file. */ +/* Define if you have the <linux/soundcard.h> header file. */ #undef HAVE_LINUX_SOUNDCARD_H -/* Define if you have the <ndir.h> header file. */ +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H -/* Define if you have the <ppm.h> header file. */ +/* Define if you have the <ppm.h> header file. */ #undef HAVE_PPM_H -/* Define if you have the <snss.h> header file. */ +/* Define if you have the <SDL/SDL.h> header file. */ +#undef HAVE_SDL_SDL_H + +/* Define if you have the <snss.h> header file. */ #undef HAVE_SNSS_H -/* Define if you have the <strings.h> header file. */ +/* Define if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H -/* Define if you have the <sys/dir.h> header file. */ +/* Define if you have the `strtod' function. */ +#undef HAVE_STRTOD + +/* Define if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H -/* Define if you have the <sys/ipc.h> header file. */ +/* Define if you have the <sys/ipc.h> header file. */ #undef HAVE_SYS_IPC_H -/* Define if you have the <sys/ndir.h> header file. */ +/* Define if you have the <sys/ndir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H -/* Define if you have the <sys/shm.h> header file. */ +/* Define if you have the <sys/shm.h> header file. */ #undef HAVE_SYS_SHM_H -/* Define if you have the <sys/soundcard.h> header file. */ +/* Define if you have the <sys/soundcard.h> header file. */ #undef HAVE_SYS_SOUNDCARD_H -/* Define if you have the <sys/time.h> header file. */ +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H -/* Define if you have the <unistd.h> header file. */ +/* Define if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define if you have the <Wlib.h> header file. */ +/* Define if you have the <Wlib.h> header file. */ #undef HAVE_WLIB_H -/* Define if you have the <X11/extensions/Xext.h> header file. */ +/* Define if you have the <X11/extensions/Xext.h> header file. */ #undef HAVE_X11_EXTENSIONS_XEXT_H -/* Define if you have the <X11/extensions/XShm.h> header file. */ +/* Define if you have the <X11/extensions/XShm.h> header file. */ #undef HAVE_X11_EXTENSIONS_XSHM_H -/* Define if you have the <X11/vroot.h> header file. */ +/* Define if you have the <X11/vroot.h> header file. */ #undef HAVE_X11_VROOT_H -/* Define if you have the <X11/xpm.h> header file. */ +/* Define if you have the <X11/xpm.h> header file. */ #undef HAVE_X11_XPM_H -/* Define if you have the ggi library (-lggi). */ -#undef HAVE_LIBGGI - -/* Define if you have the gii library (-lgii). */ -#undef HAVE_LIBGII - -/* Define if you have the m library (-lm). */ -#undef HAVE_LIBM - -/* Define if you have the pbm library (-lpbm). */ -#undef HAVE_LIBPBM - -/* Define if you have the pgm library (-lpgm). */ -#undef HAVE_LIBPGM - -/* Define if you have the ppm library (-lppm). */ -#undef HAVE_LIBPPM - -/* Define if you have the snss library (-lsnss). */ -#undef HAVE_LIBSNSS +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline -/* Define if you have the W library (-lW). */ -#undef HAVE_LIBW +/* Name of package */ +#undef PACKAGE -/* Define if you have the Xext library (-lXext). */ -#undef HAVE_LIBXEXT +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE -/* Define if you have the Xpm library (-lXpm). */ -#undef HAVE_LIBXPM +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t -/* Define if you have the z library (-lz). */ -#undef HAVE_LIBZ +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS -/* Name of package */ -#undef PACKAGE +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME /* Version number of package */ #undef VERSION +/* Define if your processor stores words with the most significant byte first + (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING diff -u --new-file --recursive tuxnes-0.75-vanilla/configure.in tuxnes-0.75/configure.in --- tuxnes-0.75-vanilla/configure.in Mon Apr 16 03:08:07 2001 +++ tuxnes-0.75/configure.in Sat Mar 9 10:51:44 2002 @@ -31,7 +31,7 @@ dnl Don't assume we want high level optimisations, it is known to dnl produce broken code on certain architectures using certain compilers dnl -------------------------------------------------------------------- -CFLAGS="-O" +CFLAGS="-O -g" AC_SUBST(CFLAGS) dnl -------------------------------------------------------------------- @@ -138,6 +138,20 @@ AC_CHECK_LIB(snss, openSnssFile) dnl -------------------------------------------------------------------- +dnl Check for SDL +dnl -------------------------------------------------------------------- +AC_ARG_WITH(sdl,\ +[ --without-sdl disable check for SDL (Simple Directmedia Lib.)]) + +if test "x$with_sdl" != "xno"; then + OCPPFLAGS="$CPPFLAGS" + CPPFLAGS="-I/usr/local/include" + AC_CHECK_HEADERS(SDL/SDL.h, CFLAGS="$CFLAGS -I/usr/local/include") + AC_CHECK_LIB(SDL, SDL_Init) + CPPFLAGS="$OCPPFLAGS" +fi + +dnl -------------------------------------------------------------------- dnl Check for GGI dnl -------------------------------------------------------------------- AC_ARG_WITH(ggi,\ diff -u --new-file --recursive tuxnes-0.75-vanilla/renderer.c tuxnes-0.75/renderer.c --- tuxnes-0.75-vanilla/renderer.c Wed Apr 11 23:45:47 2001 +++ tuxnes-0.75/renderer.c Sat Mar 9 10:47:10 2002 @@ -34,6 +34,12 @@ extern void UpdateDisplayOldX11(void); #endif +#ifdef HAVE_SDL +extern int InitDisplaySDL(int argc, char **argv); +extern void UpdateColorsSDL(void); +extern void UpdateDisplaySDL(void); +#endif + #ifdef HAVE_GGI extern int InitDisplayGGI(int argc, char **argv); extern void UpdateColorsGGI(void); @@ -69,6 +75,11 @@ RENDERER_OLD, InitDisplayX11, UpdateDisplayOldX11, UpdateColorsX11 }, #endif /* HAVE_X */ +#ifdef HAVE_SDL + { "sdl", "SDL renderer", + 0, + InitDisplaySDL, UpdateDisplaySDL, UpdateColorsSDL }, +#endif /* HAVE_SDL */ #ifdef HAVE_GGI { "ggi", "GGI renderer", 0, diff -u --new-file --recursive tuxnes-0.75-vanilla/renderer.h tuxnes-0.75/renderer.h --- tuxnes-0.75-vanilla/renderer.h Wed Apr 11 23:45:47 2001 +++ tuxnes-0.75/renderer.h Sat Mar 9 10:33:45 2002 @@ -29,6 +29,12 @@ #endif #endif +#ifdef HAVE_LIBSDL +#ifdef HAVE_SDL_SDL_H +#define HAVE_SDL 1 +#endif +#endif + /* only the no-op renderer `none' is universally known */ extern int InitDisplayNone(int argc, char **argv); extern void UpdateColorsNone(void); diff -u --new-file --recursive tuxnes-0.75-vanilla/sdl.c tuxnes-0.75/sdl.c --- tuxnes-0.75-vanilla/sdl.c Thu Jan 1 01:00:00 1970 +++ tuxnes-0.75/sdl.c Sun Mar 10 14:18:32 2002 @@ -0,0 +1,337 @@ +/* + * This file is part of the TuxNES project codebase. + * + * Please see the README and COPYING files for more information regarding + * this project. + * + * Description: This file handles the I/O subsystem when using SDL. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifdef HAVE_FEATURES_H +#include <features.h> +#endif /* HAVE_FEATRES_H */ + +#include "consts.h" +#include "globals.h" +#include "mapper.h" +#include "renderer.h" +#include "sound.h" + +#ifdef HAVE_SDL + +#include <SDL/SDL.h> +#include <SDL/SDL_endian.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <unistd.h> + +#define BPP 8 + +SDL_Surface *screen; + +/* ============================ InitDisplaySDL () ========================== */ +int InitDisplaySDL(int argc, char **argv) +{ + int i; + struct timeval time; + if (magstep < 1) + magstep = 1; + if (magstep > maxsize) { + fprintf(stderr, "Warning: Enlargement factor %d is too large!\n", + magstep); + magstep = maxsize; + } + bpp = BPP; + bytes_per_line = 256 * magstep * BPP / 8; + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); + if ((screen = + SDL_SetVideoMode(256 * magstep, 240 * magstep, BPP, + SDL_SWSURFACE)) == NULL) { + fprintf(stderr, "Unable to set 256x240 video: %s\n", + SDL_GetError()); + exit(1); + } + SDL_WM_ToggleFullScreen(screen); + rfb = fb = screen->pixels; + fbinit(); + gettimeofday(&time, NULL); + renderer_data.basetime = time.tv_sec; + return 0; +} + +/* ============================ handle_key () ============================== */ +static void handle_key(SDL_KeyboardEvent * ev) +{ + if (ev->keysym.sym == SDLK_ESCAPE) + exit (0); + + /* the coin and dipswitch inputs work only in VS UniSystem mode */ + if (unisystem) + switch (ev->keysym.sym) { + case SDLK_LEFTBRACKET: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + coinslot ^= 1; + } else if (ev->type == SDL_KEYDOWN) + coinslot |= 1; + else + coinslot &= ~1; + break; + case SDLK_RIGHTBRACKET: if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + coinslot ^= 2; + } else if (ev->type == SDL_KEYDOWN) + coinslot |= 2; + else + coinslot &= ~2; + break; + case SDLK_BACKSLASH: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + coinslot ^= 4; + } else if (ev->type == SDL_KEYDOWN) + coinslot |= 4; + else + coinslot &= ~4; + break; + case SDLK_q: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x01; + break; + case SDLK_w: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x02; + break; + case SDLK_e: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x04; + break; + case SDLK_r: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x08; + break; + case SDLK_t: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x10; + break; + case SDLK_y: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x20; + break; + case SDLK_u: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x40; + break; + case SDLK_i: + if (ev->type == SDL_KEYDOWN) + dipswitches ^= 0x80; + break; + default: + break; + } + + switch (ev->keysym.sym) { + /* controller 1 keyboard mapping */ + case SDLK_RETURN: + case SDLK_KP_ENTER: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= STARTBUTTON; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= STARTBUTTON; + else + controller[0] &= ~STARTBUTTON; + break; + case SDLK_TAB: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= SELECTBUTTON; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= SELECTBUTTON; + else + controller[0] &= ~SELECTBUTTON; + break; + case SDLK_UP: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= UP; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= UP; + else + controller[0] &= ~UP; + break; + case SDLK_DOWN: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= DOWN; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= DOWN; + else + controller[0] &= ~DOWN; + break; + case SDLK_LEFT: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= LEFT; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= LEFT; + else + controller[0] &= ~LEFT; + break; + case SDLK_RIGHT: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= RIGHT; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= RIGHT; + else + controller[0] &= ~RIGHT; + break; + case SDLK_HOME: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controllerd[0] ^= (UP | LEFT); + } else if (ev->type == SDL_KEYDOWN) + controllerd[0] |= (UP | LEFT); + else + controllerd[0] &= ~(UP | LEFT); + break; + case SDLK_PAGEUP: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controllerd[0] ^= (UP | RIGHT); + } else if (ev->type == SDL_KEYDOWN) + controllerd[0] |= (UP | RIGHT); + else + controllerd[0] &= ~(UP | RIGHT); + break; + case SDLK_END: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controllerd[0] ^= (DOWN | LEFT); + } else if (ev->type == SDL_KEYDOWN) + controllerd[0] |= (DOWN | LEFT); + else + controllerd[0] &= ~(DOWN | LEFT); + break; + case SDLK_PAGEDOWN: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controllerd[0] ^= (DOWN | RIGHT); + } else if (ev->type == SDL_KEYDOWN) + controllerd[0] |= (DOWN | RIGHT); + else + controllerd[0] &= ~(DOWN | RIGHT); + break; + case SDLK_z: + case SDLK_x: + case SDLK_d: + case SDLK_INSERT: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= BUTTONB; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= BUTTONB; + else + controller[0] &= ~BUTTONB; + break; + case SDLK_a: + case SDLK_c: + case SDLK_SPACE: + case SDLK_DELETE: + if (renderer_config.sticky_keys) { + if (ev->type == SDL_KEYDOWN) + controller[0] ^= BUTTONA; + } else if (ev->type == SDL_KEYDOWN) + controller[0] |= BUTTONA; + else + controller[0] &= ~BUTTONA; + break; + default: + break; + } +} + +/* ============================ UpdateDisplaySDL () ======================== */ +void UpdateDisplaySDL(void) +{ + struct timeval time; + unsigned static int frame; + unsigned int timeframe; + SDL_Event event; + /* FIXME: Write SDL audio handler */ + UpdateAudio(); + gettimeofday(&time, NULL); + timeframe = (time.tv_sec - renderer_data.basetime) * 50 + time.tv_usec / 20000; /* PAL */ + timeframe = (time.tv_sec - renderer_data.basetime) * 60 + time.tv_usec / 16666; /* NTSC */ + frame++; + if (halfspeed) + timeframe >>= 1; + if (doublespeed == 2) + timeframe <<= 1; + else if (doublespeed > 2) + timeframe *= doublespeed; + if (desync) + frame = timeframe; + desync = 0; + if (frame < timeframe - 20 && frame % 20 == 0) + desync = 1; /* If we're more than 20 frames behind, might as well stop counting. */ + drawimage(PBL); + if (!frameskip) { + SDL_UpdateRect(screen, 0, 0, 0, 0); + } + if (frame > timeframe + 1 && frameskip == 0) { + usleep(16666 * (frame - timeframe - 1)); + } + + /* FIXME: write SDL handler */ + if (jsfd[0] >= 0) + HandleJoystickLinux(0); + + if (jsfd[1] >= 0) + HandleJoystickLinux(1); + + while (SDL_PollEvent(&event)) { + switch (event.type) { + case SDL_KEYDOWN: + case SDL_KEYUP: + handle_key(&event.key); + break; + case SDL_QUIT: + exit(0); + } + } + + gettimeofday(&time, NULL); + timeframe = (time.tv_sec - renderer_data.basetime) * 60 + time.tv_usec / 16666; /* NTSC */ + if (halfspeed) + timeframe >>= 1; + if (doublespeed == 2) + timeframe <<= 1; + else if (doublespeed > 2) + timeframe *= doublespeed; + if (frame >= timeframe || frame % 20 == 0) + frameskip = 0; + else + frameskip = 1; +} + +/* ============================ UpdateColorsSDL () ========================= */ +void UpdateColorsSDL(void) +{ + /* FIXME */ + int i; + for (i = 0; i < 25; i++) + palette[i] = i; +} + +#endif /* HAVE_SDL */ ================================================================================ -- Mike :wq |