A small module to load raw image data for Desktop, Android and iOS.

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
874
Had a bit of time to spare, so I knocked up a module to load image data into a data structure.
Instructions in the attached zip.

Updated to include Android.
Updated to include iOS.

I would suggest keeping an eye on the amount of memory being used.
 

Attachments

  • imageload.zip
    9.2 KB · Views: 5
Last edited:

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,210
Well done dawlane.

Jimmy, I think that repository contains nothing regarding Android, only the title. Besides that, GLFW is mainly a Window handler, so I fail to see the usage in porting it to a mobile platform. But the authors millage may vary.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
874
@MikeHart Just realised that the glfw, android and ios target modules have public image loaders in the BBGame class. They just need to be wrapped to get the image data back in a Cerberus Array. I'll probably have a look at the weekend.
 

Jimmy

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,021
Looking forward to that, nice progress!
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
874
Just realised that the glfw, android and ios target modules have public image loaders in the BBGame class. They just need to be wrapped to get the image data back in a Cerberus Array. I'll probably have a look at the weekend.
OK. Update.
Trying to wrap that code isn't going to be easy. So I've stuck to keeping the loading in the module depending on the target.

I've updated the first post to include an updated module, with name changes and Android support.
On Android you are pretty much at the mercy of when it's garbage collector decided to free memory.
 

Jimmy

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,021
This is really nice examples how to make native extensions! Much appreciated!
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
874
I've updated the first post to include an updated module, with iOS support.
 

Jimmy

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,021
Nice! Is it possible to save using the same technique on iOS?
 

Jimmy

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,021
I don't have any ios device to try on yet but thanks for the tip

First I need to riddle out common support API 30 on Android that will take a few weeks I guess. This time it seems like they settle down for what API to use, which is nice.
 

Jimmy

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,021
I will only use API 30's MediaStore and Intents on Android to make it easier and more user-friendly.
A general file access would be nice of course so might look into that as well.
 
Top Bottom