Intro
How Chapter 2 works?
- Init()
SDL_Init()
SDL_CreateWindow()
SDL_GetWindowSurface()
- loadMedia()
SDL_LoadBMP()
- copy image(Blit) into surface with
SDL_BlitSurface()
. - update window with
SDL_UpdateWindowSurface()
to refresh and show what we’ve done.- you can delay loop( for window lasting) with
SDL_Delay()
.
- you can delay loop( for window lasting) with
- close()
SDL_FreeSurface()
SDL_DestroyWindow()
SDL_Quit()
Function
SDL_LoadBMP()
|
|
- param
file
: the file containing a BMP image
- return
- surface that contain BMP on success
- NULL on failure
Gets SDL_Surface object from BMP file and returns its address.
SDL_FreeSurface()
|
|
- param
surface
: the SDL_Surface to free
- return is void
free surface object on memory.
SDL_BlitSurface()
|
|
- param
src
: the SDL_Surface structure to be copied fromsrcrect
: the SDL_Rect structure representing the rectangle to be copied, or NULL to copy the entire surfacedst
: the SDL_Surface structure that is the blit targetdstrect
: the SDL_Rect structure representing the rectangle that is copied into
- return
- 0 on blit success
- negative integer as error code on failure
Blit image into surface’s rect area or entire surface.
Struct
- nothing new
Term
- nothing new