SFML community forums

Help => General => Topic started by: adrianr on January 01, 2013, 03:29:02 am

Title: Cross-Platform Resource Loading
Post by: adrianr on January 01, 2013, 03:29:02 am
Just started working with SFML 2.0 and I'm loving it! I'm working on a small application that requires loading images from resource and saw this nice wiki entry by Laurent https://github.com/SFML/SFML/wiki/Source%3A-Load-Image-From-Resource

Even though I'm developing on windows, I would like to use a more cross-platform friendly approach to load resources. (The "LoadImageFromResource(); is windows specific)

Does SFML have anything like that?

Edit: On second look, that entry isn't as relevant as I mentioned. To clarify: I would prefer not to use "LoadImage()", "LoadBitmap()" which are inside the windows.h header.
Title: AW: Cross-Platform Resource Loading
Post by: eXpl0it3r on January 01, 2013, 09:49:45 am
So with 'Resource' do you just mean images or as in thr wiki entry from a resource (.rc) file? Because the .rc file is Windows or even Visual Studio only. ;)

To load some images you can simply call sf::Texture tex; tex.loadFromFile("img.png");

To load from a package of resources you'll have to look a bit further (e.g. using zlib would be a way).

And if you actually want to integrate the resources into the executable, things can get even more complex for different compilers (which ones are you using?)