38 lines
649 B
C
38 lines
649 B
C
// 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);
|
|
}
|