3
#include <emscripten.h>
6
SDL_Init(SDL_INIT_VIDEO);
7
SDL_Surface *screen = SDL_SetVideoMode(600, 400, 8, SDL_HWSURFACE | SDL_HWPALETTE);
9
//initialize sdl palette
10
//with red green and blue
28
SDL_SetColors(screen, pal, 0, 3);
30
SDL_FillRect(screen, NULL, 0);
33
SDL_Rect rect = { 300, 0, 300, 200 };
34
SDL_FillRect(screen, &rect, 1);
38
SDL_Rect rect = { 0, 200, 600, 200 };
39
SDL_FillRect(screen, &rect, 2);
42
//changing green color
45
SDL_SetColors(screen, pal, 1, 1);
48
SDL_Rect rect = { 300, 200, 300, 200 };
49
SDL_FillRect(screen, &rect, 1);
52
printf("you should see red, blue and yellow rectangles\n");