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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Scorbutics

Pages: [1]
1
Yes, exactly.

I know it might be a little bit slow to load single files, but it would provide a way to load data from an external point of view.
Meaning that you don't have to package everything in the apk file, but will be able to build for example, a "launcher" application that will start some games from any location on the SD card.

2
Hi everyone,

Lately I've been playing around with SFML 2.5.1 on Android (I'm currently using it at the core of a ruby based engine, where SFML is used in a dynamic library (so) file).
Things work pretty well, but for modularity reasons (the engine should be able to load different games with various resources), I need to externalize loaded resources from any directory location of the Android device.

Meaning that, I want to specify an explicit filesystem location while using the existing internal SFML loaders functions `loadXXXFromFile`, and not having to explicitely load everything in memory on the ruby side then pass it to SFML using `loadFromMemory`.

I would suggest adding a CMake constant `SFML_SYSTEM_USE_FS` instead of directly testing on the platform `SFML_SYSTEM_ANDROID`.
Of course, the constant would not be defined by default on Android, but would be on other platforms.

Example : Line 120 of 'src/SFML/Graphics/Image.cpp' would be something like
bool Image::loadFromFile(const std::string& filename)
{
    #ifdef SFML_SYSTEM_USE_FS
        return priv::ImageLoader::getInstance().loadImageFromFile(filename, m_pixels, m_size);
    #else
        priv::ResourceStream stream(filename);
        return loadFromStream(stream);
    #endif
 }
 

And the same goes for `Font.cpp`.

What do you think about this request ?
If the community agree with it, I'm able to push the changes in a Pull Request on the official repository.

End note :
Currently, I'm patching SFML 2.5.1 to suppress the if preprocessor directive.

Pages: [1]