Advertisement
Guest User

trash

a guest
Jan 18th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. // this will take yeeeaaars
  2. //using SDL and standard IO thing
  3.  
  4. #include <SDL.h>
  5. #include <stdio.h>
  6.  
  7. //screen (Scream) size
  8.  
  9. const int SCREEN_WIDTH = 1024;
  10. const int SCREEN_HEIGHT = 768;
  11.  
  12. int main(int argc, char* args[])
  13.  
  14. {
  15. //the window
  16. SDL_Window* window = NULL;
  17.  
  18. SDL_Surface* screenSurface = NULL;
  19.  
  20. //initialize SDL
  21.  
  22. if (SDL_Init(SDL_INIT_VIDEO) < 0)
  23.  
  24. {
  25. printf("SDL could not initialize, SDL_Error %s\n", SDL_GetError() );
  26. }
  27.  
  28. else
  29.  
  30. {
  31. //make a window already
  32.  
  33. window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
  34. if (window = NULL)
  35. {
  36. printf("Window couldn't be created, dummy. SDL_Error: %s\n", SDL_GetError());
  37. }
  38. else
  39. {
  40. //Get window surface
  41. screenSurface = SDL_GetWindowSurface(window);
  42.  
  43. //Fill the surface white
  44.  
  45. SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
  46. // update the serface
  47. SDL_UpdateWindowSurface(window);
  48. //Wait four seconds
  49. SDL_Delay(4000);
  50. }
  51. }
  52.  
  53. //break the window
  54. SDL_DestroyWindow(window);
  55. //stop SDL
  56. SDL_Quit();
  57.  
  58. return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement