Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. // Init SDL
  2. SDL_Init(SDL_INIT_EVERYTHING)
  3.  
  4. // Create the Display Surface
  5. SDL_Surface *Surf_Display
  6. Surf_Display = SDL_SetVideoMode(m_nDesktopW, m_nDesktopH, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN )
  7.  
  8. // Create the "Game" Surface
  9. SDL_Surface *tempGame
  10. tempGame = SDL_CreateRGBSurface( SDL_HWSURFACE, APPW * m_nGlobalScale, APPH * m_nGlobalScale, 32, Surf_Display->format->Rmask, Surf_Display->format->Gmask, Surf_Display->format->Bmask, Surf_Display->format->Amask)
  11.  
  12. SDL_Surface *Surf_Game
  13. Surf_Game = SDL_DisplayFormat(tempGame)
  14. SDL_FreeSurface(tempGame)
  15.  
  16. // Precache a BMP
  17. SDL_Surface* Surf_Temp = NULL
  18. SDL_Surface* Surf_RealTemp = NULL
  19. SDL_Surface* Surf_Return = NULL
  20. SDL_Surface* Surf_RealReturn = NULL
  21.  
  22. Surf_Temp = SDL_DisplayFormat(Surf_Game)
  23. Surf_Temp = SDL_LoadBMP(filename.c_str())
  24.  
  25. SDL_SetColorKey(Surf_Temp, SDL_SRCCOLORKEY | SDL_RLEACCEL , SDL_MapRGB(Surf_Game->format, 255, 0, 255))
  26.  
  27. Surf_Return = SDL_DisplayFormat(Surf_Temp)
  28. SDL_FreeSurface(Surf_Temp)
  29.  
  30. Surf_RealTemp = rotozoomSurface(Surf_Return, 0, (int)(m_nDesktopH / APPH), 0)
  31. Surf_RealReturn = SDL_DisplayFormat( Surf_RealTemp )
  32. SDL_FreeSurface( Surf_RealTemp )
  33. // Surf_RealReturn gets added to a array of precached surfaces for further blitting
  34.  
  35. // Everything past here happens every frame
  36. // First Blit, This Section of code gets executed for every object in game Everything is blitted onto Surf_Game
  37. DestR.x = Origin.X
  38. DestR.y = Origin.Y
  39.  
  40. SDL_BlitSurface(Precached Surface, &SrcR, Surf_Game, &DestR)
  41.  
  42. // Atlast Surf_Game gets blitted onto the display
  43. SDL_BlitSurface(Surf_Game, NULL, Surf_Display, &DestR);
  44. SDL_Flip(Surf_Display);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement