onGenericMotionEvent not working with NewtBaseActivity

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

onGenericMotionEvent not working with NewtBaseActivity

Andreas Drewke
Hallo,

Joysticks are supported in android by overriding "onGenericMotionEvent" in a activity.

  public boolean onGenericMotionEvent(final android.view.MotionEvent event)

With my joystick no joystick event was ever fired to my JOGL based activiy, so I could not get this to work and I am not sure where the problem exists.

Its said that one has to set up the focus for the view, but as JOGL doesn't export a view, so I can not do that.
- setFocusable(true);
- setFocusableInTouchMode(true);

see here: http://forum.unity3d.com/threads/181102-Gamepad-Support

Any ideas?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: onGenericMotionEvent not working with NewtBaseActivity

Sven Gothel
Administrator
On 04/11/2014 01:31 PM, Andreas Drewke [via jogamp] wrote:

> Hallo,
>
> Joysticks are supported in android by overriding "onGenericMotionEvent" in a
> activity.
>
>   public boolean onGenericMotionEvent(final android.view.MotionEvent event)
>
> With my joystick no joystick event was ever fired to my JOGL based activiy, so
> I could not get this to work and I am not sure where the problem exists.
>
> Its said that one has to set up the focus for the view, but as JOGL doesn't
> export a view, so I can not do that.
Look at 'jogamp.newt.driver.android.WindowDriver'
where you can find
  - public final SurfaceView getAndroidView()

See example
  - com.jogamp.opengl.test.android.MovieSimpleActivity1

Yes, 'jogamp.newt.driver.android.WindowDriver' is a 'private' API class
and may change w/ any version by 'contract'.
However, this would only happen if it is reasonable and since developer
usually bundle JOGL on Android 'manually' not an issue.

Of course, I am all ears to enhance the Android impl. of the NEWT classes,
if you can make proposals (patch w/ tests ..) I like to merge those.

~Sven


signature.asc (894 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: onGenericMotionEvent not working with NewtBaseActivity

gouessej
Administrator
In reply to this post by Andreas Drewke
You remind me that I will have to support that too in NEWT Input API.
Julien Gouesse | Personal blog | Website