I've noticed that some examples handle the onTouchEvent in the Activity and some handle it in the View.
I'm using a surfaceView with a thread to run the game loop. Where should I dispatch my touch events to my thread from?
Should I send them to my thread from my view or my activity.
Thanks.
**Sorry had issues with the proper reply button.
Thanks! That is what I was thinking but with so many different approaches it's hard to tell which on works best until I try them. I see your thought on the focus and using the Activity!
I also was wondering if you prefer one activity and multiple views or a main activity for your menu and have it launch other activities for the different parts of the game (i.e. options, help, etc.)
Right now I have a base activity that controls the onscreen menu buttons and launches an activity for each of the other functions - I hope this is not another preference thing... I suspect that there are issues with the way I'm handling it but another opinion would be nice!
BTW I really like the Light Racer game - brings back memories of a certain arcade game that I dropped
hundreds of quarters into...
The activity thing is all up to you. I plan on moving everything native at some point here and at that point, I'll have all my menus and everything be in GL so I'll just have the one activity, but until then, I'm using a GameActivity, PreferencesActivity, etc.. I use a different one for each menu. Once you're playing the game, though, it's just that one, unless you want to change settings.
PS - Thanks! Glad you like LR :)
I'm just trying to wrap my head around the 2D stuff on the android - it's just a hobby right now.
It's really fun!!
Thanks for the response and I'm really gaining a lot of knowledge from your blog. The series about
your light racer game has been invaluable in my learning process!
Chris
You can use either. It's just a matter of preference. I like using the activity in a full-screen view application such as a game because there's not an issue of focus like there can be with view-based handling.