Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Init SDL
- SDL_Init(SDL_INIT_EVERYTHING)
- // Create the Display Surface
- SDL_Surface *Surf_Display
- Surf_Display = SDL_SetVideoMode(m_nDesktopW, m_nDesktopH, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN )
- // Create the "Game" Surface
- SDL_Surface *tempGame
- 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)
- SDL_Surface *Surf_Game
- Surf_Game = SDL_DisplayFormat(tempGame)
- SDL_FreeSurface(tempGame)
- // Precache a BMP
- SDL_Surface* Surf_Temp = NULL
- SDL_Surface* Surf_RealTemp = NULL
- SDL_Surface* Surf_Return = NULL
- SDL_Surface* Surf_RealReturn = NULL
- Surf_Temp = SDL_DisplayFormat(Surf_Game)
- Surf_Temp = SDL_LoadBMP(filename.c_str())
- SDL_SetColorKey(Surf_Temp, SDL_SRCCOLORKEY | SDL_RLEACCEL , SDL_MapRGB(Surf_Game->format, 255, 0, 255))
- Surf_Return = SDL_DisplayFormat(Surf_Temp)
- SDL_FreeSurface(Surf_Temp)
- Surf_RealTemp = rotozoomSurface(Surf_Return, 0, (int)(m_nDesktopH / APPH), 0)
- Surf_RealReturn = SDL_DisplayFormat( Surf_RealTemp )
- SDL_FreeSurface( Surf_RealTemp )
- // Surf_RealReturn gets added to a array of precached surfaces for further blitting
- // Everything past here happens every frame
- // First Blit, This Section of code gets executed for every object in game Everything is blitted onto Surf_Game
- DestR.x = Origin.X
- DestR.y = Origin.Y
- SDL_BlitSurface(Precached Surface, &SrcR, Surf_Game, &DestR)
- // Atlast Surf_Game gets blitted onto the display
- SDL_BlitSurface(Surf_Game, NULL, Surf_Display, &DestR);
- SDL_Flip(Surf_Display);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement