#include <SDL2/SDL.h>
int main()
{
SDL_Window *window=NULL;
SDL_Renderer *render=NULL;
//初始化环境
SDL_Init(0);
//创建一个窗口
window = SDL_CreateWindow("test",200,200,900,600,SDL_WINDOW_SHOWN|SDL_WINDOW_BORDERLESS);
if(!window)
{
}
//创建一个渲染器
render = SDL_CreateRenderer(window,-1,0);
if(!render)
{
}
//设置背景色
SDL_SetRenderDrawColor(render,255,0,0,30);
SDL_RenderDrawLine(render,300,300,600,600);
SDL_RenderClear(render);
SDL_RenderPresent(render);
SDL_Delay(5000);
//删除渲染器
SDL_DestroyRenderer(render);
//删除窗口
SDL_DestroyWindow(window);
//卸载环境
SDL_Quit();
return 0;
}