Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- #define SDL_WINDOWPOS_UNDEFINED 0
- #define SCREEN_WIDTH 800
- #define SCREEN_HEIGHT 600
- #define SDL_WINDOW_SHOWN 1
- SDL_Window* gWindow;
- SDL_Surface* gScreenSurface;
- SDL_Surface* gHelloWorld;
- int init(){
- int success = 1;
- if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
- {
- printf( "SDL could not initialize! SDL_Error: %sn", SDL_GetError() );
- success = 0;
- }
- else
- {
- gWindow = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
- if( gWindow == NULL )
- {
- printf( "Window could not be created! SDL_Error: %sn", SDL_GetError() );
- success = 0;
- }
- else
- {
- gScreenSurface = SDL_GetWindowSurface( gWindow );
- }
- }
- return success;
- }
- int loadMedia(){
- int success = 1;
- gHelloWorld = SDL_LoadBMP( "/circuit.png" );
- if( gHelloWorld == NULL )
- {
- printf( "Unable to load image! SDL Error: %sn", SDL_GetError() );
- success = 0;
- }
- return success;
- }
- void close()
- {
- SDL_FreeSurface( gHelloWorld );
- gHelloWorld = NULL;
- SDL_DestroyWindow( gWindow );
- gWindow = NULL;
- SDL_Quit();
- }
- int main(int argc, char* args[]){
- init();
- loadMedia();
- close();
- return 0;
- }
- program.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
- #include <SDL/SDL.h>
- #define SDL_WINDOWPOS_UNDEFINED=0
- #define SCREEN_WIDTH=800
- #define SCREEN_HEIGHT=600
- #define SDL_WINDOW_SHOWN=1
- warning: missing whitespace after the macro name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement