1 /*
2  * Copyright 2012 The Emscripten Authors.  All rights reserved.
3  * Emscripten is available under two separate licenses, the MIT license and the
4  * University of Illinois/NCSA Open Source License.  Both these licenses can be
5  * found in the LICENSE file.
6  */
7 
8 #include <SDL/SDL.h>
9 
10 #ifdef __EMSCRIPTEN__
11 #include <emscripten.h>
12 #endif
13 
main(int argc,char ** argv)14 int main(int argc, char **argv) {
15   SDL_Init(SDL_INIT_VIDEO);
16   SDL_Surface *screen = SDL_SetVideoMode(40, 40, 32, SDL_SWSURFACE);
17 
18   SDL_FillRect(screen, NULL, SDL_MapRGBA(screen->format, 0xff, 0, 0, 0xff));
19   SDL_LockSurface(screen);
20   *((int*)screen->pixels + 95) = 0;
21   SDL_UnlockSurface(screen);
22 
23   SDL_FillRect(screen, NULL, SDL_MapRGBA(screen->format, 0, 0xff, 0, 0xff)); // wipe out previous pixel and fill
24   SDL_LockSurface(screen);
25   *((int*)screen->pixels + 205) = 0;
26   SDL_UnlockSurface(screen);
27 
28   SDL_Flip(screen);
29 
30   return 0;
31 }
32