I have some strange problem, origins of which I don’t understand.
I have an SDL2 application built and working on Windows, and now I’m trying to build a Linux version. I am using Code::Blocks on both systems. After I set up all the paths and libraries in Code::Blocks on Linux, it builds and runs normally.
But when I move executable and all the needed files to separate directory, I suddenly get strange behaviour: all images now have lost their transparency and they are looking very messed up.
I just don’t understand what’s going on. Why everything works inside IDE and such strange thing happens when you try to run it like normal executable?
Advertisement
Answer
OK, here’s the thing: I found out, that if I run my executable from file manager (i.e. by clicking on a run.sh script) everything is fine. But if I try to run this script from command line I get this problems with transparency.
I still get errors about “Invalid renderer” on SDL_SetTextureBlendMode call, though, but they might not be actually related, since maybe I forgot to check every other SDL call on errors and that report is just some leftover from another call.
But, still, does anybody have any ideas why it’s the way it is?
I got to this kind of solution when I downloaded latest version of ADOM with graphics for Linux. I picked version for Debian 6.0.5 as being the closest to mine – I have 7. When I tried to run the game from the command line, I got the same issue with transparency that I had with my application. Then I decided to try and run it from the file browser just by clicking on the executable – and voila! Everything works.
WTF…
Just for the info, my run.sh script, that I used to run the exe, looks like this:
#!/bin/sh export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib ./Asteroids-x64