Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #include <SDL/SDL.h>
  2. #define SDL_WINDOWPOS_UNDEFINED 0
  3. #define SCREEN_WIDTH 800
  4. #define SCREEN_HEIGHT 600
  5. #define SDL_WINDOW_SHOWN 1
  6.  
  7. SDL_Window* gWindow;
  8. SDL_Surface* gScreenSurface;
  9. SDL_Surface* gHelloWorld;
  10.  
  11. int init(){
  12. int success = 1;
  13. if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
  14. {
  15. printf( "SDL could not initialize! SDL_Error: %sn", SDL_GetError() );
  16. success = 0;
  17. }
  18. else
  19. {
  20. gWindow = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
  21. if( gWindow == NULL )
  22. {
  23. printf( "Window could not be created! SDL_Error: %sn", SDL_GetError() );
  24. success = 0;
  25. }
  26. else
  27. {
  28. gScreenSurface = SDL_GetWindowSurface( gWindow );
  29. }
  30. }
  31. return success;
  32. }
  33.  
  34. int loadMedia(){
  35. int success = 1;
  36. gHelloWorld = SDL_LoadBMP( "/circuit.png" );
  37. if( gHelloWorld == NULL )
  38. {
  39. printf( "Unable to load image! SDL Error: %sn", SDL_GetError() );
  40. success = 0;
  41. }
  42. return success;
  43. }
  44.  
  45. void close()
  46. {
  47. SDL_FreeSurface( gHelloWorld );
  48. gHelloWorld = NULL;
  49. SDL_DestroyWindow( gWindow );
  50. gWindow = NULL;
  51. SDL_Quit();
  52. }
  53.  
  54. int main(int argc, char* args[]){
  55. init();
  56. loadMedia();
  57. close();
  58. return 0;
  59. }
  60.  
  61. program.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  62.  
  63. #include <SDL/SDL.h>
  64. #define SDL_WINDOWPOS_UNDEFINED=0
  65. #define SCREEN_WIDTH=800
  66. #define SCREEN_HEIGHT=600
  67. #define SDL_WINDOW_SHOWN=1
  68.  
  69. warning: missing whitespace after the macro name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement