FCT
载入中...
搜索中...
未找到
Android_Runtime.cpp
浏览该文件的文档.
1#include "../FCTAPI.h"
2#include "Runtime.h"
3#include "Android_Runtime.h"
4
5
6namespace FCT{
8 void Android_Runtime::init(JNIEnv *env, jobject activity) {
9 JavaVM* vm;
10 env->GetJavaVM(&vm);
11 m_vm = new jni::JvmRef<jni::kDefaultJvm>{vm};
12 m_activity = new jni::GlobalObject<FCTMainActivityJavaClass>(
13 std::move(jni::LocalObject<FCTMainActivityJavaClass>
14 {activity}));
15 fout << "FCT Device Info:" << std::endl;
16 fout << "Size: " << getDeviceWidth() << "x" << getDeviceHeight() << std::endl;
17
19 m_uiCommon->preinit();
20
21 m_userThread = new std::thread([this]{
22 jni::ThreadGuard threadGuard = m_vm->BuildThreadGuard();
23 entry();
24 cleanUp();
25 });
26 m_userThread->detach();
27 }
28
30
31 }
32
34 main();
35 }
36
38 m_uiCommon->cleanup();
39 delete m_uiCommon;
40 }
41
43 return m_activity->Call<"getDeviceHeight">();
44 }
45
47 return m_activity->Call<"getDeviceWidth">();
48 }
50
51 };
53
54 }
55
57
58 }
59
61 return g_androidRuntime->getDeviceWidth();
62 }
63
65 return g_androidRuntime->getDeviceHeight();
66 }
67
71
73 return new VK_Context(g_common->vkContextCommon);
74 }
75}
76
77extern "C"
78JNIEXPORT void JNICALL
JNIEXPORT void JNICALL Java_com_example_androidtutorial_FCTMainActivity_CPPEntry(JNIEnv *env, jobject thiz)
void init(JNIEnv *env, jobject activity)
jni::GlobalObject< FCTMainActivityJavaClass > * m_activity
Android_UICommon * m_uiCommon
jni::JvmRef< jni::kDefaultJvm > * m_vm
RuntimeCommon * g_common
std::ostream & fout
Android_Runtime * g_androidRuntime