[brlcad-commits] SF.net SVN: brlcad:[38920] isst/trunk/sdl/main.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <eri...@us...> - 2010-04-29 20:58:50
|
Revision: 38920 http://brlcad.svn.sourceforge.net/brlcad/?rev=38920&view=rev Author: erikgreenwald Date: 2010-04-29 20:58:43 +0000 (Thu, 29 Apr 2010) Log Message: ----------- horribly ugly hackish basic framework to throw up a window and event loop... Modified Paths: -------------- isst/trunk/sdl/main.c Modified: isst/trunk/sdl/main.c =================================================================== --- isst/trunk/sdl/main.c 2010-04-29 20:45:15 UTC (rev 38919) +++ isst/trunk/sdl/main.c 2010-04-29 20:58:43 UTC (rev 38920) @@ -27,9 +27,40 @@ int main(int argc, char **argv) { + SDL_Surface *screen; + SDL_Event e; + SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER); atexit (SDL_Quit); - return 0; + + /* can we make this resizable? */ + screen = SDL_SetVideoMode (800, 600, 24, SDL_DOUBLEBUF); + + /* TODO: some stuff to load up geometry and set up the isst buffers */ + + /* main event loop */ + while (1) + { + /* TODO: ask libtie/librender to fill the isst buffer */ + /* TODO: copy/blit the isst buffer into the sdl screen */ + SDL_UpdateRect(screen, 0, 0, 0, 0); + SDL_WaitEvent (&e); + switch (e.type) + { + case SDL_KEYDOWN: + switch (tolower (e.key.keysym.sym)) + { + case 'x': + case 'q': + case SDLK_ESCAPE: + SDL_Quit (); + return EXIT_SUCCESS; + break; + /* TODO: more keys for nifty things like changing mode or pulling up gui bits or something */ + } + /* TODO: look for mouse events */ + } + } } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |