#include #include #include #include #include #include #include #include #include #include #include #include #include #include SDL_Surface * screen, * surf; SDL_Color colors[256]; SDL_Thread *thredd; char keypress; void gl_fillbox(int whx, int why, int wid, int hei, int col){ SDL_Rect rect; Uint32 pix; rect.w=wid;rect.h=hei;rect.x=whx;rect.y=why; pix= SDL_MapRGB (screen->format, 0,col,0); SDL_FillRect (screen, &rect, pix); } int main(int argc, char **argv) { // init sdl argv[1] argv[2] as x and y int bpp,i; char xx; int x,y; int width=atoi(argv[1]);int height=atoi(argv[2]); if (SDL_Init (SDL_INIT_VIDEO) < 0) { fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ()); exit (1); } SDL_ShowCursor (SDL_DISABLE); atexit (SDL_Quit); bpp = SDL_VideoModeOK (width, height, 8, SDL_HWSURFACE | SDL_HWPALETTE); screen = SDL_SetVideoMode (width, height, bpp,SDL_HWSURFACE | SDL_HWPALETTE); /* deal with colours */ for (i=0;i<256;i++){ colors[i].r=i; colors[i].g=i; colors[i].b=i; } SDL_SetColors(screen, colors, 0, 256); // read stdin while(1){ for (y=0;y