daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   SDL_Init(SDL_INIT_VIDEO);
  2.    
  3.    
  4.     int flags = IMG_INIT_PNG | IMG_INIT_JPG;
  5.     if((IMG_Init(flags)&flags) != flags) {
  6.         printf("Error starting SDL_Image\n");  }
  7.  
  8.    
  9.    
  10.    
  11.     WinP = SDL_CreateWindow("Flag Bearer",700,100,1100,700,SDL_WINDOW_OPENGL);
  12.    
  13.     WinP2 = SDL_CreateWindow("Player stats",100,60,500,500,SDL_WINDOW_OPENGL);
  14.    
  15.      if(WinP == NULL){
  16.         printf("Window  one failed to be created: %s\n",SDL_GetError());
  17.         }
  18.    
  19.     if(WinP2 == NULL){
  20.         printf("window two failed to be created: %s\n", SDL_GetError());
  21.         }    
  22.        
  23.     WinPS = SDL_GetWindowSurface(WinP);
  24.    
  25.     WinP2S = SDL_GetWindowSurface(WinP2);
  26.    
  27.  
  28.     WinPSa = IMG_Load("C:\\Users\\VostavCrun\\Pictures\\REFERENCES USE THIS DAMMIT\\greying_kingdom_starter_set.png");
  29.    
  30.     if(WinPSa == NULL){
  31.         printf("unable to load image %s! SDL_image Error: %s\n",  "C:\\Users\\VostavCrun\\Pictures\\REFERENCES USE THIS DAMMIT\\greying_kingdom_starter_set.png ",IMG_GetError());  
  32.        
  33.     }
  34.    
  35.         //convert surface to screen format
  36.         optimzedSurface = SDL_ConvertSurface(WinPSa, WinPS->format, NULL);
  37.        
  38.         //apllying image from getting window surface
  39.         SDL_BlitSurface(WinPSa,NULL,WinPS,NULL);
  40.        
  41.        
  42.        
  43.        
  44.    
  45.    
  46.    
  47.    
  48.     while(SDL_PollEvent(&E)){
  49.        
  50.        
  51.            
  52.        
  53.        
  54.         switch(E.key.keysym.sym ){
  55.            
  56.             case SDLK_BACKSPACE:
  57.          
  58.          WinP2Sb = IMG_Load("C:\\Users\\VostavCrun\\Pictures\\REFERENCES USE THIS DAMMIT\\46b58b07ff43b2b2edd3572491db90de.jpg");
  59.          
  60.          optimzedSurface2 = SDL_ConvertSurface(WinP2Sb,WinP2S->format,NULL);
  61.          
  62.          SDL_BlitSurface(WinP2Sb,NULL,WinP2S,NULL);
  63.          
  64.          
  65.             break;
  66.            
  67.            
  68.            
  69.            
  70.            
  71.         }
  72.         }
  73.        
  74.        
  75.      
  76.        
  77.        
  78.        
  79.        
  80.    
  81.     SDL_UpdateWindowSurface(WinP);
  82.     SDL_UpdateWindowSurface(WinP2);
  83.  
  84.    
  85.     SDL_Delay(6000);
  86.    
  87.    
  88.     IMG_Quit();
  89.      SDL_FreeSurface(WinPSa);
  90.     SDL_DestroyWindow(WinP);
  91.    
  92.     SDL_DestroyWindow(WinP2);
  93.    
  94.    
  95.    
  96.    
  97.    
  98.    
  99.     return 0;
  100. }
RAW Paste Data
Top