On 12/10/2014 5:59 PM, Paul wrote:
Adding that reveals that I need to add SDL_image 2.0 (I didn't know that
that wasn't a part of the standard SDL install) so I've compiled that
too. I now get the error:
Unsupported image format
whether I use a png or jpg.
int flags = IMG_INIT_PNG | IMG_INIT_JPG;
if( IMG_Init( flags ) != flags )
{
...
}
https://www.libsdl.org/projects/SDL_image/docs/SDL_image_8.html
IMG_Load() does however work in the same way as SDL_LoadBMP if I feed it
a .bmp - the image is displayed but there is a seg fault.
I recommend you give it a try with a hardware renderer and see what
happens. That could potentially narrow it down a bit.
Also, though this is unrelated (I just noticed it when looking at your
code again), I strongly recommend you move the line
scope( exit ) SDL_Quit();
to somewhere after DerelictSDL2.load(). If the SDL shared library fails
to load for some reason, an exception will be thrown and as the function
exits the runtime will happily call SDL_Quit -- even though it will very
likely be a null pointer at that point since the library never loaded.
Always keep in mind when using Derelict that you're working through
function pointers since the shared libraries are loaded manually. If the
library fails to load because it was missing, none of the function
pointers will be valid. If loading aborts because a function is missing,
only the ones loaded before it will have been properly set, so that case
should be treated as if they are all invalid.