Guest User

Untitled

a guest
May 20th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. #include "SDL/SDL.h"
  2. #include "SDL/SDL_image.h"
  3.  
  4. //Surface
  5. SDL_Surface *wateranimation1 = NULL;
  6. SDL_Surface *snowanimation1 = NULL;
  7.  
  8. //Screen Surface
  9. SDL_Surface *Screen = NULL;
  10.  
  11.  
  12. //Main Function for thread
  13. int MainFunction(void *unused)
  14. {
  15.   SDL_BlitSurface(wateranimation1,NULL,Screen,NULL);
  16.   SDL_BlitSurface(snowanimation1,NULL,Screen,NULL);
  17.   SDL_Flip(Screen);
  18.   SDL_Delay(100);
  19. }
  20.  
  21.  
  22. //Main Entry
  23. int main(int argc ,char *argv[])
  24. {
  25.         //On and Off Switch for Application
  26.         bool done = false;
  27.  
  28.         //Image Loading
  29.         wateranimation1 = IMG_Load("WaterAnimation1.png");
  30.         snowanimation1 = IMG_Load("SnowAnimation1.png");
  31.  
  32.         //Screen Setup
  33.         Screen = SDL_SetVideoMode(640,480,32,SDL_HWSURFACE);
  34.  
  35.         //Screen Title
  36.         SDL_WM_SetCaption("SDL Layer Test",NULL);
  37.  
  38.         //Main Thread Creation
  39.         SDL_Thread *MainThread;
  40.  
  41.         //Main Thread Setup
  42.         MainThread = SDL_CreateThread(MainFunction,NULL);
  43.  
  44.         //Event Creation
  45.         SDL_Event event;
  46.  
  47.         //Main Event Loop
  48.         while(!done)
  49.         {
  50.           while(SDL_PollEvent(&event))
  51.             {
  52.               switch(event.type)
  53.                 {
  54.                 case SDL_QUIT:
  55.                   return 0;
  56.                   break;
  57.  
  58.                 }
  59.             }
  60.         }
  61.  
  62. }
Add Comment
Please, Sign In to add comment