This document is not done. On Going!!
#
Intro
#
How Chapter 7 works?
#
- init()
SDL_Init()SDL_SetHint()SDL_CreateWindow()SDL_CreateRenderer()SDL_SetRenderDrawColor()IMG_Init()
- loadMedia()
- loadTexture()
- load PNG file on intermediate surface with
IMG_Load(). - create texture from loaded surface with
SDL_CreateTextureFromSurface().- 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). - clear screen(render) with
SDL_RenderClear(). - render texture(copy) on screen with
SDL_RenderCopy(). - update screen(of window) with
SDL_RenderPresent() to refresh and show what we’ve done.
- close()
SDL_DestroyTexture()SDL_DestroyRenderer()SDL_DestroyWindow()IMG_Quit()SDL_Quit()
- now we are not using screen surface as our primary canvas anymore; instead renderer!
- loadSueface() -> loadTexture()
- SDL_GetWindowSurface() is gone from init()
- instead, SDL_SetHint(), SDL_CreateRenderer() and SDL_SetRenderDrawColor() are required
- SDL_BlitSurface() is replaced into SDL_RenderClear() and SDL_RenderCopy()
- SDL_UpdateWindowSurface() is replaced into SDL_RenderPresent()
- SDL_FreeSurface() is gone from close()
- instead, SDL_DestroyTexture() and SDL_DestroyRenderer() are required
Function
#
SDL_SetHint()
#
SDL_CreateRenderer()
#
SDL_SetRenderDrawColor()
#
SDL_CreateTextureFromSurface()
#
SDL_RenderClear()
#
SDL_RenderCopy()
#
SDL_RenderPresent()
#
SDL_DestroyTexture()
#
SDL_DestroyRender()
#
Struct
#
SDL_Renderer
#
SDL_Texture
#
Term
#
SDL_SetHint()
#
- SDL_HINT_RENDER_SCALE_QUALITY
SDL_CreateRender()
#