aboutsummaryrefslogtreecommitdiff
path: root/source/Irrlicht/Android/CKeyEventWrapper.h
blob: b6bc09bf02e2ba3cdfb41c22c23e90f9d7516c8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

#ifndef __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__
#define __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__


#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_

#include <jni.h>

struct android_app;

namespace irr
{
namespace jni
{

//! Minimal JNI wrapper class around android.view.KeyEvent
//! NOTE: Only functions we actually use in the engine are wrapped
//! This is currently not written to support multithreading - meaning threads are not attached/detached to the Java VM (to be discussed)
class CKeyEventWrapper
{
public:
	CKeyEventWrapper(JNIEnv* jniEnv, int action, int code);
	~CKeyEventWrapper();

	int getUnicodeChar(int metaState);

private:
	static jclass Class_KeyEvent; 
	static jmethodID Method_getUnicodeChar;
	static jmethodID Method_constructor;
	JNIEnv* JniEnv;
	jobject JniKeyEvent;	// this object in java
};

} // namespace jni
} // namespace irr

#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_
#endif // __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__