SDL Chapter 1

Intro How Chapter 1 works? Init SDL with SDL_Init(). Create window with SDL_CreateWindow(). Get surface with SDL_GetWindowSurface(). do something with surface. (like SDL_FillRect()). Update surface with SDL_UpdateWindowSurface(). you can delay loop( for window lasting) with SDL_Delay(). If you done all your jobs with SDL, Destroy window with SDL_DestroyWindow(). Don’t forget calling SDL_Quit() for terminating all jobs! SDL.h main header file for sdl....

January 1, 1970 · 4 min · Niiok

SDL Chapter 2

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(). close() SDL_FreeSurface() SDL_DestroyWindow() SDL_Quit() Function SDL_LoadBMP() 1 SDL_Surface* SDL_LoadBMP( const char* file ); 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....

January 1, 1970 · 1 min · Niiok

SDL Chapter 3

Intro How Chapter 3 works? Init() SDL_Init() SDL_CreateWindow() SDL_GetWindowSurface() loadMedia() SDL_LoadBMP() start loop untill variable quit is true. start loop that calls SDL_PollEvent() untill it returns 0. if SDL_Event.type is SDL_QUIT, quit is true( which means first loop will end). copy screen(Blit) with SDL_BlitSurface(). update window with SDL_UpdateWindowSurface() to refresh and show what we’ve done. close() SDL_FreeSurface() SDL_DestroyWindow() SDL_Quit() Function SDL_PollEvent() 1 int SDL_PollEvent( SDL_Event* event ); param event : the SDL_Event structure to be filled with the next event from the queue, or NULL return 1 if queue contains any event inside 0 if there’s no event in queue when this function called, event at head will be removed from queue and stored to event....

January 1, 1970 · 1 min · Niiok

SDL Chapter 4

Intro How Chapter 4 works? init() SDL_Init() SDL_CreateWindow() SDL_GetWindowSurface() loadMedia() put surfaces in SDL_Surface* array( is global variable) with SDL_LoadBMP(). start loop untill variable quit is true. start loop that calls SDL_PollEvent() untill it returns 0. if SDL_Event.type is SDL_QUIT, quit is true( which means first loop will end). else if SDL_Event.type is SDL_KEYDOWN, choose mapped sruface to key inside SDL_Surface* array( is global variable)....

January 1, 1970 · 1 min · Niiok

SDL Chapter 5

Intro How Chapter 5 works? init() SDL_Init() SDL_CreateWindow() SDL_GetWindowSurface() loadMedia() loadSurface() load BMP file on intermediate surface with SDL_LoadBMP(). optimize loaded intermediate surface into optimized surface with SDL_ConvertSurface(). free memory of intermediate surface with SDL_FreeSurface(). start loop untill variable quit is true. start loop that calls SDL_PollEvent() untill it returns 0. if SDL_Event.type is SDL_QUIT, quit is true( which means first loop will end)....

January 1, 1970 · 2 min · Niiok