SDL2.0学习

#include "SDL.h"

SDL_Window* g_windows = 0 ;
SDL_Renderer* g_prender = 0;


int main(int argc, char* args[])
{

	//初始化SDL
	if (SDL_Init(SDL_INIT_EVERYTHING)>=0)
	{
		//创建SDL窗口
		g_windows=SDL_CreateWindow("set up sdl windows",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN);

		if (g_windows != 0 )
		{
			g_prender = SDL_CreateRenderer(g_windows,-1,0);
		}

	}else{

		return 1;

	}


	//设置渲染颜色
	SDL_SetRenderDrawColor(g_prender,0,0,0,255);
	
	SDL_RenderClear(g_prender);

	SDL_RenderPresent(g_prender);
	
	SDL_Delay(5000);

	SDL_Quit();

	return 0 ;
	
}



简单写了一下注释 其实没啥可以解释的 ,基本的构建就是这样,SDL 结构也是如此 !

你可能感兴趣的:(SDL2.0学习)