- 先安装SDL以提供SDL支持
- 安装CLION以开发SDL程序
- 代码如下:
main.cpp
include<SDL/SDL.h>
include<stdlib.h>
int main(){
SDL_Surface *screen;
Uint32 color;
int x;
if(SDL_Init(SDL_INIT_VIDEO)<0){
fprintf(stderr,"SDL运行错误%s\n",SDL_GetError());
exit(1);
}
screen=SDL_SetVideoMode(640,480,16,SDL_SWSURFACE);
if(screen==NULL){
fprintf(stderr,