Hide the ugliness of JNI
This commit is contained in:
+3
-31
@@ -49,38 +49,9 @@ struct application_info
|
||||
#endif
|
||||
};
|
||||
|
||||
class application;
|
||||
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
class jni_thread
|
||||
{
|
||||
JNIEnv * env = nullptr;
|
||||
JavaVM * vm = nullptr;
|
||||
|
||||
public:
|
||||
explicit jni_thread(application & app);
|
||||
jni_thread();
|
||||
~jni_thread();
|
||||
|
||||
JNIEnv * get_JNIEnv()
|
||||
{
|
||||
return env;
|
||||
}
|
||||
};
|
||||
#else
|
||||
class [[maybe_unused]] jni_thread
|
||||
{
|
||||
public:
|
||||
explicit jni_thread(application & app) {}
|
||||
jni_thread() = default;
|
||||
~jni_thread() = default;
|
||||
};
|
||||
#endif
|
||||
|
||||
class application
|
||||
{
|
||||
friend class scene;
|
||||
friend class jni_thread;
|
||||
|
||||
application_info app_info;
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
@@ -108,8 +79,6 @@ class application
|
||||
|
||||
static application * instance_;
|
||||
|
||||
jni_thread jni;
|
||||
|
||||
// OpenXR stuff
|
||||
xr::instance xr_instance;
|
||||
xr::system xr_system_id;
|
||||
@@ -306,6 +275,9 @@ public:
|
||||
|
||||
application(const application &) = delete;
|
||||
~application();
|
||||
#ifdef XR_USE_PLATFORM_ANDROID
|
||||
void setup_jni();
|
||||
#endif
|
||||
|
||||
static bool is_session_running()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user