Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Android input support  (Read 1360 times)

calsmurf2904

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Android input support
« on: February 22, 2010, 07:26:05 AM »

Hello, I'm a member of the Ogre forum and am currently in the process of porting Ogre to android, the problem is that the samples provided with ogre use OIS for input, but OIS doesn't have input support.

What I'm proposing is these functions:

Code: [Select]
#include <jni.h>

void Java_com_OIS_InitOIS(JNIEnv*  env);
void Java_com_OIS_HandleTouchEvent(JNIEnv* env, jint x, jint y);
void Java_com_OIS_HandleKeyEvent(JNIEnv* env, jint keycode);

So that the application can call these from java to handle any key input in OIS.
How Android handles input can be found here:
http://developer.android.com/reference/android/view/View.OnKeyListener.html#onKey(android.view.View, int, android.view.KeyEvent)
And here:
http://developer.android.com/reference/android/view/View.OnTouchListener.html

Note: Even though android supports native functions, its input system is java-only, thats why I'm proposing the OIS native functions to handle the java events.

Thanks in advance,

Calsmurf2904
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: Android input support
« Reply #1 on: February 22, 2010, 08:41:15 PM »

I'd be interested in an Android port. Sad how the input system is Java only. I don't understand, however, the point of the method stubs you posted.

Are those functions to be called from within Java to OIS, or from native through OIS to Java?
Logged

calsmurf2904

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: Android input support
« Reply #2 on: February 23, 2010, 02:25:16 AM »

Those are functions that Java should call to OIS. (C++ exported functions to java have a really weird function name)
That way, OIS will just become a passthrough, but there currently is no other way to support it. (It is indeed sad that only java gets input :()
I hoped this can be done since I would like the Ogre Samples to run on android too (and they use OIS).
Logged