2024年5月10日发(作者:)

SDL2 API手册

目录:

(1)SDL_CreateWindow(const char *title,int x,int y,int w,int h,Unit32 flags)

(2)SDL_CreateRenderer(SDL_Window *window,int index,Uint32 flags)

(3)SDL_LoadBMP(const char *file)

(4)SDL_CreateTextureFromSurface(SDL_Renderer

*surface)

*renderer,SDL_Surface

(5)SDL_FreeSurface(SDL_Surface *surface)

(6)SDL_RenderClear(SDL_Renderer *renderer)

(7)SDL_RenderCopy(SDL_Renderer *renderer,SDL_Texture *texture,const

SDL_Rect *srrect,const SDL_Rect *dstrect)

(8)SDL_RenderPresent(SDL_Renderer *renderer)

(9)SDL_DestroyTexture(SDL_Texture *texture)

(10)SDL_DestroyRenderer(SDL_Render *renderer)

(11)SDL_DestroyWindow(SDL_Window *window)

(12)SDL_Delay(Uint32 ms)

(13)SDL_Init(Uint32 flags)

(14)SDL_Quit()

(15)SDL_FillRect(SDL_Surface *dst,const SDL_Rect *rect,Uint32 color)

(16)SDL_MapRGB(const SDL_PixelFormat *format,Uint8 r,Uint8 g,Uint8 b)

(17)SDL_UpdateWindowSurface(SDL_Window *window)

(1)SDL_Window *SDL_CreateWindow(const char *title,int x,int y,int w,int

h,Unit32 flags):创建一个窗口。成功,则返回一个SDL_Window指针;失败,则返回

一个NULL。

1)第一个参数title:为窗口标题。

2)第二(或三)个参数x(或y)为:窗口坐标。

3)第四(或五)个参数w(h)为:窗口的长(宽)。

4)第六个参数flags:窗口标签。它可以是:SDL_WINDOW_FULLSCREEN(全屏),

SDL_WINDOW_OPENGL,SDL_WINDOW_SHOWN(显示),SDL_WINDOW_HIDDEN