1 /* ResidualVM - A 3D game interpreter 2 * 3 * ResidualVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ANDROID_TOUCHCONTROLS_H_ 24 #define ANDROID_TOUCHCONTROLS_H_ 25 26 #if defined(__ANDROID__) 27 28 #include "common/events.h" 29 30 #include "backends/platform/android/events.h" 31 #include "backends/platform/android/texture.h" 32 33 class TouchControls { 34 public: 35 TouchControls(); 36 ~TouchControls(); 37 38 void init(KeyReceiver *kr, int width, int height); 39 void draw(); 40 void update(int ptr, int action, int x, int y); 41 42 private: 43 int _screen_width, _screen_height; 44 KeyReceiver *_key_receiver; 45 46 enum TouchArea{ 47 kTouchAreaJoystick = 0xffff, 48 kTouchAreaCenter = 0xfffe, 49 kTouchAreaRight = 0xfffd, 50 kTouchAreaNone = 0xfffc, 51 }; 52 53 uint16 getTouchArea(int x, int y); 54 55 struct Pointer { 56 uint16 startX, startY; 57 uint16 currentX, currentY; 58 TouchArea function; 59 bool active; 60 }; 61 62 enum { kNumPointers = 5 }; 63 Pointer _pointers[kNumPointers]; 64 int _activePointers[4]; 65 Common::KeyCode _joystickPressing, _centerPressing, _rightPressing; 66 int &pointerFor(TouchArea ta); 67 GLESTexture *_arrows_texture; 68 69 }; 70 71 #endif 72 73 #endif 74