diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9062af9 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +all: + gcc bare.c -o bare `sdl-config --cflags --libs` + +clean: + -rm -f *~ *.o bare diff --git a/bare.c b/bare.c new file mode 100644 index 0000000..b82432b --- /dev/null +++ b/bare.c @@ -0,0 +1,37 @@ +// Author: Josh Holtrop +// Date: 11/10/05 +// Purpose: barebones SDL program + +#include "SDL/SDL.h" +#include "stdio.h" + +int main() +{ + SDL_Surface *screen; + SDL_Event event; + + if (SDL_Init(SDL_INIT_VIDEO)) + { + printf("Failed to initialize SDL!\n"); + return 1; + } + + atexit(SDL_Quit); + + if (!(screen = SDL_SetVideoMode(256, 256, 32, SDL_DOUBLEBUF | SDL_HWSURFACE))) + { + printf("Failed to set video mode!\n"); + return 2; + } + + SDL_FillRect(screen, NULL, 0); + Uint32 *pixels = screen->pixels; + Uint32 c; + for (c = 0; c < 65536; c++) + *pixels++ = c; + SDL_Flip(screen); + + while (SDL_WaitEvent(&event) != 0) + if (event.type == SDL_KEYDOWN) + exit(0); +}