Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- #include <libconfig.h>
- int main (int argc, char *argv[])
- {
- printf ("This is my simple renderer version %i.%i\n", 1,1);
- if (argc != 2)
- {
- fprintf (stderr, "Usage: demo config\n");
- exit (1);
- }
- config_t cfg;
- config_init (&cfg);
- config_read_file (&cfg, argv[1]);
- config_destroy (&cfg);
- if (SDL_Init (SDL_INIT_VIDEO) != 0)
- {
- fprintf(stderr, "Cannot init SDL\n");
- exit (1);
- }
- // SDL_EnableUNICODE(SDL_ENABLE);
- SDL_Surface *screen = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE);
- if (screen == NULL)
- {
- fprintf(stderr, "Cannot init screen\n");
- exit (1);
- }
- SDL_Rect rect;
- rect.w = 800;
- rect.h = 600;
- SDL_FillRect (screen, &rect, SDL_MapRGB (screen->format, 255,255,255));
- SDL_Flip (screen);
- while (1)
- {
- SDL_Event event;
- if (SDL_WaitEvent(&event))
- {
- switch (event.type) {
- case SDL_QUIT:
- SDL_Quit();
- exit(0);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement