UbuntuでSDL
emscriptenをスタディしていたらSDLをサポートしてるっぽいので、とりあえずSDLをスタディするためhello, world。環境はUbuntu12.04。
まずSDLをインストール。
$ sudo apt-get install libsdl1.2-dev
[hello.c]
#includeint main()
{
SDL_Init(SDL_INIT_VIDEO);
SDL_WM_SetCaption("hello, world", NULL);
SDL_SetVideoMode(256, 256, 32, SDL_SWSURFACE);
SDL_Event ev;
int bExit = 0;
while(bExit == 0)
{
while(SDL_PollEvent(&ev))
{
if(ev.type == SDL_QUIT)
{
bExit = 1;
break;
}
}
SDL_Delay(20);
}
SDL_Quit();return 0;
}
ビルド・実行。
$ gcc -o hello hello.c -lSDL
$ ./hello
"hello, world"とキャプションのついたウインドウが表示された。