April 2015
Beginner to intermediate
494 pages
10h 26m
English
Let's extend our new Input system with more event types:
jni/InputHandler.hpp and add the keyboard and trackball event handlers:#ifndef _PACKT_INPUTHANDLER_HPP_
#define _PACKT_INPUTHANDLER_HPP_
#include <android/input.h>
class InputHandler {
public:
virtual ~InputHandler() {};
virtual bool onTouchEvent(AInputEvent* pEvent) = 0;
virtual bool onKeyboardEvent(AInputEvent* pEvent) = 0;
virtual bool onTrackballEvent(AInputEvent* pEvent) = 0;
};
#endifprocessInputEvent() inside the existing file jni/EventLoop.cpp to redirect the keyboard and trackball events to InputHandler.Trackballs and touch events are assimilated to motion events and can be discriminated ...