Omnimaga
General Discussion => Technology and Development => Computer Programming => Topic started by: jwalker on February 01, 2013, 11:01:26 pm
-
I got all of the libs/includes/dll's set up correctly and the program compiles just fine, and runs, but the window that pops up doesn't display anything. What its supposed to do is display an image, after some debugging, I think it SDL_LoadBMP cant seem to find the image. The same code worked just fine on Ubuntu at school. I have the image in the same directory as the program and the project, and I have tried just placing the image in C:\, but it still dosen't work. Has anyone else had this problem?
I can upload the code if you really need it.
-
The code might be important. Try with an absolute path to see if maybe its a problem with relative paths?
-
FIXED: I loaded the image before setting the video mode, although I don't know if it dose have anything to do with it
Was:
image = LoadImage("image.bmp");
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
Now:
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
image = LoadImage("image.bmp");
-
Do you use SDL_DisplayFormat for helping loading the image to format well? That could cause the problem with the image.
-
Yes, I had that implemented right away, I based this off of a tutorial I have been using, the source is below if anyone wants it.
-
New question, when using a list, why does the destructor for the object that you are placing in the list get called?
-
I wouldn't think it would be.
-
I was tracing the code with the debugger and it seemed to do that, maybe I messed up somewhere, but it still doesn't make a lot of sense to me that it would call the destructor, when creating an object.
-
If you are placing an object in one of the SDL containers and goes beyond allocated memory, then the container will move itself to another location in memory. I don't know if it calls the destructor on objects inside itself though.
-
I'm using an STL list as the container, maybe I should look into an SDL one though
-
Oops, that was a typo, I meant to say STL, as in the Standard Library. :P
-
Oh, Ok
-
Is the image thing fixed yet? It could be a path issue. The path relativity is from where you run the program, so maybe you're running the program in a different folder than your image?
-
The image thing is fixed