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

Author Topic: SFML in Android with the NDK  (Read 2279 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
SFML in Android with the NDK
« on: July 08, 2012, 01:13:27 am »
Hello,

I decided to make this post to share my experience while converting my engine from sfml normal use to a full cross-platform solution. Mainly about the things that came in the way.

1 - Main function

No more main function as you need a thin Java layer to interact with your native code, and the activity lifecycle is controlled by the Java.

2 - Asset managing

The usual way to have assets is to pack them in the /assets/ directory in your APK, and they are inside a zip later in the device. There are tricks to read them with FILE* but you need to be really carefull.

3 - Sound

In android ndk, you can use OpenSL ES for sound, but its not recommended as it adds trouble and only supports android 2.1+ if im not mistaken. Java sound access would be better, and that means sf::Sound stuff won't do.

4 - Graphics

OpenGL ES is a must, and must be conditionally compiled along with OpenGL if you want cross-platform apps. Also GLU is not available in android, but you may use GLUES, which is handy.

I can complete this list with more detail and items if you find it interesting, as i've passed through all major porting issues so far, i'd say. This is just to mention that porting to android is not going to be that simple as changing the rendering code.

Hope it helps


kaB00M

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Caffeware
    • Email
Re: SFML in Android with the NDK
« Reply #1 on: July 12, 2012, 05:05:03 pm »
Check this new console coming next year:  http://www.kickstarter.com/projects/ouya/ouya-a-new-kind-of-video-game-console

It's Android based. Will Sfml be there in the future?