I am currently in the process of making a SHMUP. I have a background ready to blit, but when I apply the background to the screen, it doesn't show up. I am flipping the screen, in case you were wondering. Also, when I test the image I am trying to use isn't NULL. I am using Code::Blocks on windows vista. My images are pngs and are in a folder titled "SHMUP." Directly inside SHMUP are my images, my project, and a SHMUP.exe file. Also in the SHMUP folder are the "bin" and "obj" folders. Inside bin is Debug, and inside Debug is another SHMUP.exe! There are also other dlls and files of those sort(I am on my iPod I can't completely remember) in bin/Debug. When I put my images in the directory of the other exe (bin/Debug) my program crashes and returns 3. I am so confused, I have done so much googling it's ridiculous. Does anyone think they can help?
a few things:
1) post some code relevant to the issue
2) IIRC, Code::Blocks runs the program from the directory where the project file is, so make sure the file path is correct from that.
3) Image loading and drawing code both seem to be relevant here.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
I added code. Also, the .exe that is in the location of the project file crashes when I run it. The other .exe in bin/Debug runs fine, but doesn't blit the images. And what do you mean by "make sure the file path is correct?" What file path?
And I know what's also coming about my code. I will try to implement error handling functions.
A- Your path is incorrect and your program can't find it
B- You've not got "libpng.dll" in your executables directory (You'll get no error message and the program will execute but you won't be able to use the SDL_Image library.
I've tried putting libpng12-0.dll basically everywhere, and it still doesn't work. I also checked to see if my images were NULL, and it appears that they aren't NULL. The build log says:
Checking for existence: ...\SHMUP\SHMUP.exe
Executing: ...\SHMUP\SHMUP.exe (in ...\SHMUP\bin\Debug)
I think I've had this problem before, or a similar problem. I ended up putting all my SDL related DLL files in my windows/system32 folder because I was tired of it.
krilik wrote:I think I've had this problem before, or a similar problem. I ended up putting all my SDL related DLL files in my windows/system32 folder because I was tired of it.
Which works great until you try to redistribute it.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Yeah SDL_image.dll is needed but I suggested libpng.dll because if you it will still run fine with it however SDL will refuse to load anything. Whereas with SDL_image.dll you get a pretty obvious error.
It needs to be in the same folder as the .exe you're running, if it still doesn't work you must be giving a incorrect filename.
I implemented error functions, and in stdout.txt it says:
Couldn't open playerShip.png
Couldn't open miniShip.png
Couldn't open medShip.png
Couldn't open bigShip.png
Couldn't open miniBullet.png
Couldn't open medBullet.png
Couldn't open bigBullet.png
Couldn't open background.png
I am 99% sure my filenames are correct. Could it have to do with the working directories and such? I am confused how those work, so I might be wrong.
It's definitely problem of filepath. Your files should be in 1 of 2 places: where your executable is, or where your source files are. If one of them doesn't work, it's almost definitely the other.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.