Hi everyone!
I’ve been away for a couple of days and haven’t been able to write a blog post, but now I suppose is a good time. The last couple days I’ve been working on refactoring gesture-code, so that the new (and old!) widgets can respond to gestures without resorting to ugly hacks and such.
The way this is implemented (currently, subject to change!) is by a couple of new events, such as EVENT_FINGERMOVE, EVENT_TAPDOWN, EVENT_TAPUP etc. The events are also associated with one or more “fingers”, which contain information about the current position of each finger which is tracked, thereby enabling widgets at certain places to respond to when a finger is tapped on them (right now I’m “reusing” the handleMouseDown-function each widget has, but the plan is of course to add a “handleFingerDown”, “handleFingerMove” and similar functions). Currently, I’ve coded support for these new events in the android port, but other ports should be trivial to add. Also, now, since games still rely on mouse events, I’ve had to create an event listener and injector, a “TouchMapper”, where all code regarding movement of the cursor in game has been refactored into (right now, one can either use direct mode or “touch-pad mode”-where dragging over the screen will move the cursor like a touch pad, tapping the left area will simulate a left click and the right area a right click).
As usual, code can be found in my repository. Anyways, that’s all for now!