Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by i4ba1 ( 15 years ago )
#include "SDL.h"
#include "SDL_image.h"
#include <iostream>

using namespace std;

SDL_Surface *screen = NULL;
SDL_Surface* ball = NULL;


int main(int argc, char* args[])
{
 SDL_Init(SDL_INIT_EVERYTHING); 

 //set up screen
 screen = SDL_SetVideoMode(640,480,16,SDL_SWSURFACE);

 //Load Image
 ball = IMG_Load("D:/c++/images/new_ball.png");

 if(ball == NULL)
 {
  cout << "ball is null";
 }


 //Apply image to the screen
 SDL_BlitSurface(ball, NULL,screen, NULL);

 //Update Screen
 SDL_Flip(screen);

 //Pause
 SDL_Delay(2000);

 //Free the loade image
 SDL_FreeSurface(ball);

 SDL_QUIT;

 return 0;
}

 

Revise this Paste

Your Name: Code Language: