一、基本游戏架构
二、示例
1. example01---基于基本游戏架构的example00:
/******************************************************************************
game strtucture:
initialise
|
|
----get input
| |
| |
| do physics
| |
| |
-----render
|
|
exit
base on game strture, modify example00
******************************************************************************/
SDL_Window *g_pWindow = NULL;
SDL_Renderer*g_pRenderer = NULL;
bool g_bRunning = false;
Uint8 g_r = 0, g_g = 0, g_b = 0;
bool init(const char *title, int xpos, int ypos, int height, int width, int flags)
{
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) return false;
g_pWindow = SDL_CreateWindow(title, xpos, ypos, height, width, flags);
if (NULL == g_pWindow) return false;