<pre name="code" class="cpp">#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
int SDL_main(int argc, char * argv[])
{
SDL_Window *window = NULL;
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)
{
fprintf(stderr, "SDL_Init() failed\n");
exit(-1);
}
atexit(SDL_Quit);
window = SDL_CreateWindow("Window Title",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,480, SDL_WINDOW_OPENGL);
if(NULL==window){
fprintf(stderr, "SDL_CreateWindow() failed\n");
exit(-1);
}
SDL_ShowWindow(window);
SDL_DestroyWindow(window);
window = NULL;
return 0;
}
SDL窗口的创建、显示和销毁
最新推荐文章于 2024-10-05 10:24:37 发布