第一个SDL程序

不废话,就WinMain主体:

SDL_Window* window = NULL;
 SDL_Renderer* renderer = NULL;
 SDL_Event e;
 bool q = 0;
 int sdl = SDL_Init(SDL_INIT_EVERYTHING);
 if(0 <= sdl){
  window = SDL_CreateWindow("SDL Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN);
  if(0 != window){
   renderer = SDL_CreateRenderer(window, -1, 0);
  }
  SDL_SetRenderDrawColor(renderer, 0, 255, 255, 255);
  SDL_RenderClear(renderer);
  SDL_RenderPresent(renderer);
  while(0 == q){
   while (0 != SDL_PollEvent(&e)){
    if(e.type == SDL_QUIT){
     q = TRUE;
    }
   }
  }
 }
 SDL_Quit();

posted @ 2018-06-03 20:44  天使冰王  阅读(194)  评论(0编辑  收藏  举报