MCPcopy Create free account
hub / github.com/android/ndk-samples / GameLoop

Method GameLoop

endless-tunnel/app/src/main/cpp/native_engine.cpp:100–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void NativeEngine::GameLoop() {
101 mApp->userData = this;
102 mApp->onAppCmd = _handle_cmd_proxy;
103 mApp->onInputEvent = _handle_input_proxy;
104
105 while (!mApp->destroyRequested) {
106 // If not animating, block until we get an event; if animating, don't block.
107 struct android_poll_source* source = nullptr;
108 auto result = ALooper_pollOnce(IsAnimating() ? 0 : -1, NULL, nullptr,
109 (void**)&source);
110 MY_ASSERT(result != ALOOPER_POLL_ERROR);
111 // process event
112 if (source != NULL) {
113 source->process(mApp, source);
114 }
115
116 if (IsAnimating()) {
117 DoFrame();
118 }
119 }
120}
121
122JNIEnv* NativeEngine::GetJniEnv() {
123 if (!mJniEnv) {

Callers 1

android_mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected