Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualfutlib

Posted 01 January 2013 - 03:24 AM

I'm in the process of porting a C++ SDL/OpenGL desktop game to both Android and iOS. While SDL 1.3 covers both platforms and works pretty well for me, I feel uncomfortable using some random untested Mercurial revision of it, so I've decided to handle the creation of the OpenGL context, input and image/audio loading myself.

The only way to load texture assets from native code in Android 2.2 seems to be opening the .apk with libzip and loading the image with libpng, which is what I've done. I've not started with the iOS port yet, but based on some research, it seems that I can just read the textures from storage and load them with libpng there as well.

While this works, it's a lot of code I don't fully understand yet, so I'm wondering if it isn't better to use each platform's canonical means of loading images, namely Bitmap in Android, UIImage in iOS and SDL_image on desktop. That sounds like inviting a bunch of platform-specific bugs though, I like the idea of having as much shared code as possible.

Does anybody have experiences with either approach? Can't decide which one to go with.

#2futlib

Posted 01 January 2013 - 03:24 AM

I'm in the process of porting a C++ SDL/OpenGL desktop game to both Android and iOS. While SDL 1.3 covers both platforms and works pretty well for me, I feel uncomfortable using some random untested Mercurial revision of it, so I've decided to handle the creation of the OpenGL context, input and image/audio loading myself.

The only way to load texture assets from native code in Android 2.2 seems to be opening the .apk with libzip and loading the image with libpng, which is what I've done. I've not started with the iOS port yet, but based on some research, it seems that I can just read the textures from storage and load them with libpng there as well.

While this works, it's a lot of code I don't fully understand yet, so I'm wondering if it isn't better to use each platform's canonical means of loading images, namely Bitmap in Android, UIImage in iOS and SDL_image on desktop. That sounds like inviting a bunch of platform-specific bugs though, I like the idea of having as much shared code as possible.

Does anybody have experiences with either approach? Can't decide which one to go with.

#1futlib

Posted 01 January 2013 - 03:23 AM

I'm in the process of porting a C++ SDL/OpenGL desktop game to both Android and iOS. While SDL 1.3 covers both platforms and works pretty well for me, I feel uncomfortable using some random untested Mercurial revision of it, so I've decided to handle the creation of the OpenGL context and asset loading myself.

 

The only way to load texture assets from native code in Android 2.2 seems to be opening the .apk with libzip and loading the image with libpng, which is what I've done. I've not started with the iOS port yet, but based on some research, it seems that I can just read the textures from storage and load them with libpng there as well.

 

While this works, it's a lot of code I don't fully understand yet, so I'm wondering if it isn't better to use each platform's canonical means of loading images, namely Bitmap in Android, UIImage in iOS and SDL_image on desktop. That sounds like inviting a bunch of platform-specific bugs though, I like the idea of having as much shared code as possible.

 

Does anybody have experiences with either approach? Can't decide which one to go with.


PARTNERS