1 // Copyright (C) 2002-2011 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_IRR_DEVICE_ANDROID_H_INCLUDED__
\r
6 #define __C_IRR_DEVICE_ANDROID_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
10 #ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
\r
12 #include "CIrrDeviceStub.h"
\r
13 #include "IrrlichtDevice.h"
\r
14 #include "ICursorControl.h"
\r
16 #include <android/sensor.h>
\r
17 #include <android_native_app_glue.h>
\r
21 class CIrrDeviceAndroid : public CIrrDeviceStub
\r
24 CIrrDeviceAndroid(const SIrrlichtCreationParameters& param);
\r
26 virtual ~CIrrDeviceAndroid();
\r
30 virtual void yield();
\r
32 virtual void sleep(u32 timeMs, bool pauseTimer = false);
\r
34 virtual void setWindowCaption(const wchar_t* text);
\r
36 virtual bool isWindowActive() const;
\r
38 virtual bool isWindowFocused() const;
\r
40 virtual bool isWindowMinimized() const;
\r
42 virtual void closeDevice();
\r
44 virtual void setResizable(bool resize = false);
\r
46 virtual void minimizeWindow();
\r
48 virtual void maximizeWindow();
\r
50 virtual void restoreWindow();
\r
52 virtual core::position2di getWindowPosition();
\r
54 virtual E_DEVICE_TYPE getType() const;
\r
56 virtual bool activateAccelerometer(float updateInterval);
\r
58 virtual bool deactivateAccelerometer();
\r
60 virtual bool isAccelerometerActive();
\r
62 virtual bool isAccelerometerAvailable();
\r
64 virtual bool activateGyroscope(float updateInterval);
\r
66 virtual bool deactivateGyroscope();
\r
68 virtual bool isGyroscopeActive();
\r
70 virtual bool isGyroscopeAvailable();
\r
74 static void handleAndroidCommand(android_app* app, int32_t cmd);
\r
76 static s32 handleInput(android_app* app, AInputEvent* event);
\r
78 void createDriver();
\r
80 void createKeyMap();
\r
82 video::SExposedVideoData& getExposedVideoData();
\r
84 android_app* Android;
\r
85 ASensorManager* SensorManager;
\r
86 ASensorEventQueue* SensorEventQueue;
\r
87 const ASensor* Accelerometer;
\r
88 const ASensor* Gyroscope;
\r
94 JNIEnv* JNIEnvAttachedToVM;
\r
96 video::SExposedVideoData ExposedVideoData;
\r
98 core::array<EKEY_CODE> KeyMap;
\r
101 } // end namespace irr
\r
103 #endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_
\r
104 #endif // __C_IRR_DEVICE_ANDROID_H_INCLUDED__
\r