orx  stable
Portable Game Engine
orxAndroid.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2017 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
42 #ifndef _orxANDROID_H_
43 #define _orxANDROID_H_
44 
45 #include <jni.h>
46 #include <pthread.h>
47 #include <stdlib.h>
48 
49 #define KZ_CONFIG_ANDROID "Android"
50 #define KZ_CONFIG_SURFACE_SCALE "SurfaceScale"
51 #define KZ_CONFIG_ACCELEROMETER_FREQUENCY "AccelerometerFrequency"
52 #define KZ_CONFIG_USE_JOYSTICK "UseJoystick"
53 
54 #include <android/native_window.h>
55 
56 #ifdef __orxANDROID_NATIVE__
57 
58 #include <android_native_app_glue.h>
59 
60 #endif /* __orxANDROID_NATIVE__ */
61 
62 #if defined(__cplusplus)
63 extern "C"
64 {
65 #endif
66 
67 #ifdef __orxANDROID__
68 
69 enum
70 {
78  LOOPER_ID_MAIN = 1,
79  LOOPER_ID_SENSOR = 2,
80  LOOPER_ID_KEY_EVENT = 3,
81  LOOPER_ID_TOUCH_EVENT = 4,
82  LOOPER_ID_JOYSTICK_EVENT = 5,
83  LOOPER_ID_USER = 6
84 };
85 
86 enum
87 {
88  APP_CMD_PAUSE,
89  APP_CMD_RESUME,
90  APP_CMD_SURFACE_DESTROYED,
91  APP_CMD_SURFACE_CREATED,
92  APP_CMD_SURFACE_CHANGED,
93  APP_CMD_QUIT,
94  APP_CMD_FOCUS_LOST,
95  APP_CMD_FOCUS_GAINED
96 };
97 
98 typedef struct __orxANDROID_TOUCH_EVENT_t
99 {
100  orxU32 u32ID;
101  orxFLOAT fX;
102  orxFLOAT fY;
103  orxU32 u32Action;
104 
105 } orxANDROID_TOUCH_EVENT;
106 
107 #endif /*__orxANDROID__*/
108 
109 typedef struct __orxANDROID_AXIS_DATA_t
110 {
111  union
112  {
113  struct
114  {
115  orxFLOAT fX;
116  orxFLOAT fY;
117  orxFLOAT fZ;
118  orxFLOAT fRZ;
119  orxFLOAT fHAT_X;
120  orxFLOAT fHAT_Y;
121  orxFLOAT fRTRIGGER;
122  orxFLOAT fLTRIGGER;
123  };
124 
125  orxFLOAT afValues[8];
126  };
127 
129 
130 typedef struct __orxANDROID_JOYSTICK_EVENT_t
131 {
132  orxU32 u32Type;
133  orxU32 u32DeviceId;
134 
135  union
136  {
137  orxU32 u32KeyCode;
139  };
140 
142 
143 typedef struct __orxANDROID_KEY_EVENT_t {
144  orxU32 u32Action;
145  orxU32 u32KeyCode;
146  orxU32 u32Unicode;
147 
149 
150 typedef struct __orxANDROID_SURFACE_CHANGED_EVENT_t {
151  orxU32 u32Width;
152  orxU32 u32Height;
153 
155 
156 ANativeWindow * orxAndroid_GetNativeWindow();
157 
161 const char * orxAndroid_GetInternalStoragePath();
163 void orxAndroid_JNI_GetDeviceIds(orxS32 devicesId[4]);
164 
169 
171 void orxAndroid_PumpEvents();
172 void *orxAndroid_GetJNIEnv();
173 jobject orxAndroid_GetActivity();
174 
175 #ifdef __orxANDROID_NATIVE__
176 #define LOOPER_ID_SENSOR LOOPER_ID_USER
177 ANativeActivity* orxAndroid_GetNativeActivity();
178 struct android_app* orxAndroid_GetAndroidApp();
179 #endif /* __orxANDROID_NATIVE__ */
180 
181 #if defined(__cplusplus)
182 }
183 #endif /* __orxANDROID__ */
184 
185 #define orxANDROID_EVENT_TYPE_KEYBOARD (orxEVENT_TYPE)(orxEVENT_TYPE_FIRST_RESERVED + 0)
186 #define orxANDROID_EVENT_KEYBOARD_DOWN 0
187 #define orxANDROID_EVENT_KEYBOARD_UP 1
188 
189 #define orxANDROID_EVENT_TYPE_SURFACE (orxEVENT_TYPE)(orxEVENT_TYPE_FIRST_RESERVED + 1)
190 #define orxANDROID_EVENT_SURFACE_DESTROYED 0
191 #define orxANDROID_EVENT_SURFACE_CREATED 1
192 #define orxANDROID_EVENT_SURFACE_CHANGED 2
193 
194 #define orxANDROID_EVENT_TYPE_ACCELERATE (orxEVENT_TYPE)(orxEVENT_TYPE_FIRST_RESERVED + 2)
195 
196 #define orxANDROID_EVENT_TYPE_JOYSTICK (orxEVENT_TYPE)(orxEVENT_TYPE_FIRST_RESERVED + 3)
197 #define orxANDROID_EVENT_JOYSTICK_ADDED 0
198 #define orxANDROID_EVENT_JOYSTICK_REMOVED 1
199 #define orxANDROID_EVENT_JOYSTICK_CHANGED 2
200 #define orxANDROID_EVENT_JOYSTICK_DOWN 3
201 #define orxANDROID_EVENT_JOYSTICK_UP 4
202 #define orxANDROID_EVENT_JOYSTICK_MOVE 5
203 
204 #endif /* _orxANDROID_H_ */
205 
orxANDROID_AXIS_DATA stAxisData
Definition: orxAndroid.h:138
orxU32 orxAndroid_JNI_GetRotation()
void * orxAndroid_GetJNIEnv()
void orxAndroid_JNI_GetDeviceIds(orxS32 devicesId[4])
ANativeWindow * orxAndroid_GetNativeWindow()
void orxAndroid_PumpEvents()
const char * orxAndroid_GetInternalStoragePath()
orxSTATUS
Definition: orxType.h:243
jobject orxAndroid_GetActivity()
void orxAndroid_JNI_SetupThread()
orxSTATUS orxAndroid_RegisterAPKResource()

Generated for orx by doxygen 1.5.6