SFML troubles

closed account (jw6XoG1T)
i decided to start learning SFML and i looked up the instructions on how to install it to VC++ 2010. I did everything perfectly. Now here's the problem....

I tried doing this tutorial from Lazyfoo.com and for some reason when i compile the program the only thing that shows up is a blank black screen. Any help? Here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <SDL.h>
#include <iostream>

int main(int argc, char* args[] )
{
	//The images

	SDL_Surface* hello = NULL;
	SDL_Surface* screen = NULL;

	//Start SDL

	SDL_Init (SDL_INIT_EVERYTHING);

	//Set Screen

	screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);

	//Load Image

	hello = SDL_LoadBMP("helloworld.bmp");

	//Apply image to screen

	SDL_BlitSurface(hello, NULL, screen, NULL);
	SDL_Flip(screen);
	SDL_Delay(2000);

	SDL_FreeSurface(hello);

	//Quit SDL

	SDL_Quit();


	system("pause");
	return 0;
}

Do you have a file called "helloworld.bmp" in the same file as the exe?

Does SFML support bitmaps?

Should 'system("Pause")' come before "SDL_Quit ();"
Should 'system("Pause")' come before "SDL_Quit ();"

Better question, should "SDL_Quit();",an SDL command, be used when you are trying to learn SFML? ALL of this source code is for SDL my friend, could you post the correct copy pasta the next time around?
Last edited on
closed account (jw6XoG1T)
whoah!!!!! lol sorry sorry sorry. posted the wrong name lol. I meant help with SDL :) i was trying SFML before thats why lol
Ah, that's ok I just wanted to make sure we're all on the same page.

Did you give Danny Toledo's idea a try?
closed account (jw6XoG1T)
yeah i put it in the same file and everything. even put it in some other files to see if it would work. But still nothing ;( the only thing that shows up is a black screen.
closed account (jw6XoG1T)
yeah i put it in the same file and everything. even put it in some other files to see if it would work. But still nothing ;( the only thing that shows up is a black screen.
closed account (jw6XoG1T)
yeah i put it in the same file and everything. even put it in some other files to see if it would work. But still nothing ;( the only thing that shows up is a black screen.
And it's copied and pasted exactly as it was no the web site?
closed account (jw6XoG1T)
yeah pretty much. i dont see what the problem is
The only other problem that I'm not even sure is a problem, is that you "start" SDL after declaring that there are images to be used. I don't think that that is it, but it's the only other thing that I can see.
closed account (jw6XoG1T)
actually thats how every tutorial ive seen does it lol but i dont know....this really sucks ;(
Have you tried SFML?
closed account (jw6XoG1T)
it didnt work for some reason lol i downloaded it probably 3 or 4 times and every time there was a problem with it
Well, sorry I couldn't help.
If you are running it from the IDE, try going directly to the .exe and run that.

http://cboard.cprogramming.com/game-programming/116217-i-cant-make-bmp-image-files-show-up-sdl-window.html
Topic archived. No new replies allowed.