Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cross-Platform Resource Loading  (Read 1366 times)

0 Members and 1 Guest are viewing this topic.

adrianr

  • Newbie
  • *
  • Posts: 1
    • View Profile
Cross-Platform Resource Loading
« 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.
« Last Edit: January 01, 2013, 03:40:16 am by adrianr »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Cross-Platform Resource Loading
« Reply #1 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?)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/