[android-developers] Re: Events on GLSurfaceView

2010-01-17 Thread Peter Eastman
Here is where I create and add the listener: http://gamine.svn.sourceforge.net/viewvc/gamine/trunk/src/net/sf/gamine/common/InputStage.java?revision=8view=markup It gets added in onStart(), which is called from the start() method of

[android-developers] Re: Events on GLSurfaceView

2010-01-17 Thread Robert Green
/** 196* This inner class is used to monitor key events. 197*/ 198 private class KeyListener implements View.OnKeyListener 199 { 200 public ArrayListKeyEvent currentEvents = new ArrayListKeyEvent(); 201 public ArrayListKeyEvent pendingEvents = new

[android-developers] Re: Events on GLSurfaceView

2010-01-17 Thread Peter Eastman
Got it! In the process of messing around with this, I think I had actually done all things I needed to, just never in the right combination. For the record, the essential elements were: 1. Call setFocusable(true) on the View 2. Call setFocusableInTouchMode(true) on the View 3. Return false from

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Philip
Not sure why this would happen but if you want to take a look at the cocos2d for Android code I released last night, there are a few examples on how it works. You will also notice the 20ms wait delay I added there to avoid being flooded with motion events (pressure sensivity changes are sent even

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Robert Green
Remember to call setFocusableInTouchMode(true); in the view if you want to receive focus and key/touch events. On Jan 16, 3:19 pm, Philip philip.dese...@gmail.com wrote: Not sure why this would happen but if you want to take a look at the cocos2d for Android code I released last night, there

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Peter Eastman
On Jan 16, 3:27 pm, Robert Green rbgrn@gmail.com wrote: Remember to call setFocusableInTouchMode(true); in the view if you want to receive focus and key/touch events. I wasn't doing that. I just tried it though, and it didn't fix the problem. Instead, it disabled the Back and Menu keys...

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Peter Eastman
On Jan 16, 1:19 pm, Philip philip.dese...@gmail.com wrote: Not sure why this would happen but if you want to take a look at the cocos2d for Android code I released last night, there are a few examples on how it works. Thanks, that was really helpful. After looking through your code for a

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Robert Green
That makes me think that you are now getting key events but aren't handling them properly. If you always return true, the system will not handle those keys anymore. I'm just shooting in the dark, though. Is there any way you could post some code for me to see? I'm pretty sure you need to

[android-developers] Re: Events on GLSurfaceView

2010-01-16 Thread Eyal99
I went to http://code.google.com/p/cocos2d-android/ but I don't see where to download the code. Where is it? On Jan 17, 8:26 am, Robert Green rbgrn@gmail.com wrote: That makes me think that you are now getting key events but aren't handling them properly.  If you always return true, the