참고: http://lazyfoo.net/SDL_tutorials/lesson04/index.php
컴파일 명령어 (MinGW):
gcc -Wall -o main main.cpp -lmingw32 -lSDLmain -lSDL주의) link 옵션(-l) 은 -o 옵션 뒤에 입력되어야 한다. link 순서도 중요하다.
참고: http://forum.gpwiki.org/viewtopic.php?t=6963
#include <SDL/SDL.h> int main(int argc, char* args[]) { int done = 0; SDL_Event evt; SDL_Init(SDL_INIT_EVERYTHING); SDL_Surface* screen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE); if (screen == NULL) { printf("screen is null\n"); return -1; } while(!done) { while (!done && SDL_PollEvent(&evt)) { switch (evt.type) { case SDL_QUIT: done = 1; break; case SDL_KEYDOWN: switch (evt.key.keysym.sym) { case SDLK_ESCAPE: done = 1; break; default: break; } break; default: break; } } SDL_FillRect(screen, NULL, 0); SDL_Flip(screen); } SDL_Quit(); return 0; }
댓글 없음:
댓글 쓰기