Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualDennisvb

Posted 01 March 2013 - 06:31 AM

Thank you for all the help, it's really nice to see a community like this! It was a hard to find mistake that I switched the screen and hello surfaces in that function. I will try to fix it when I am home.
Thanks again!

 

Fixed it!

 

This is the code I have now and it works.

#include "SDL.h"
#include "SDL_image.h"
#include <iostream>

int main( int argc, char* args[] )
{
    // the images
	SDL_Surface *hello = NULL;
	SDL_Surface *screen = NULL;

	SDL_Init( SDL_INIT_EVERYTHING );

	SDL_WM_SetCaption( "Rocket 0.0.1" , NULL );

	// create the window
	screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

	hello = IMG_Load( "image.png" );
	if( !hello ) {
		std::cout << "ERROR: " << SDL_GetError() << std::endl;
	}

	SDL_BlitSurface( hello, NULL, screen, NULL );

	// update the screen
	SDL_Flip( screen );

	SDL_Delay( 2000 );

	// unload the image
	SDL_FreeSurface( hello );

	return 0;
}

 

The first problem was I had my image in the wrong directory and the second one was the SDL_BlitSurface problem.

Thanks everybody!


#1Dennisvb

Posted 01 March 2013 - 05:21 AM

Thank you for all the help, it's really nice to see a community like this! It was a hard to find mistake that I switched the screen and hello surfaces in that function. I will try to fix it when I am home.
Thanks again!

PARTNERS