add mutex to App::update, move custom app-glue to git submodule
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -49,3 +49,6 @@
|
||||
[submodule "libs/hash-library"]
|
||||
path = libs/hash-library
|
||||
url = https://github.com/stbrumme/hash-library
|
||||
[submodule "libs/native_app_glue"]
|
||||
path = libs/native_app_glue
|
||||
url = https://bitbucket.org/omigamedev/native_app_glue.git
|
||||
|
||||
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.4.1)
|
||||
# build native_app_glue as a static lib
|
||||
add_library(
|
||||
app-glue STATIC
|
||||
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c
|
||||
../libs/native_app_glue/android_native_app_glue.c
|
||||
)
|
||||
|
||||
# Specifies a library name, specifies whether the library is STATIC or
|
||||
@@ -94,7 +94,6 @@ add_library(
|
||||
)
|
||||
|
||||
target_include_directories(native-lib PRIVATE
|
||||
${ANDROID_NDK}/sources/android/native_app_glue
|
||||
src/main/cpp
|
||||
../src
|
||||
../libs/glm
|
||||
@@ -106,7 +105,8 @@ target_include_directories(native-lib PRIVATE
|
||||
../libs/poly2tri/poly2tri
|
||||
../libs/base64
|
||||
../libs/sqlite3
|
||||
../libs/nanort
|
||||
../libs/nanort
|
||||
../libs/native_app_glue
|
||||
)
|
||||
|
||||
# add lib dependencies
|
||||
|
||||
1
libs/native_app_glue
Submodule
1
libs/native_app_glue
Submodule
Submodule libs/native_app_glue added at a8f8dba9ee
27
src/app.cpp
27
src/app.cpp
@@ -443,7 +443,11 @@ void App::async_end()
|
||||
|
||||
void App::update(float dt)
|
||||
{
|
||||
static std::mutex mutex;
|
||||
static float rec_timer = 0.f;
|
||||
|
||||
// avoid multiple threads to update the scene
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
|
||||
static std::mutex m;
|
||||
std::lock_guard<std::mutex> _lock(m);
|
||||
@@ -511,16 +515,19 @@ void App::update(float dt)
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/*
|
||||
uirtt.bindFramebuffer();
|
||||
uirtt.clear();
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
|
||||
layout[main_id]->m_children[i]->watch(observer);
|
||||
//msgbox->watch(observer);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
uirtt.unbindFramebuffer();
|
||||
*/
|
||||
|
||||
if (vr_active)
|
||||
{
|
||||
uirtt.bindFramebuffer();
|
||||
uirtt.clear();
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
|
||||
layout[main_id]->m_children[i]->watch(observer);
|
||||
//msgbox->watch(observer);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
uirtt.unbindFramebuffer();
|
||||
}
|
||||
|
||||
#if __IOS__
|
||||
[ios_view->glview bindDrawable];
|
||||
#else
|
||||
|
||||
@@ -53,7 +53,7 @@ void App::cloud_upload()
|
||||
|
||||
auto m = layout[main_id]->add_child<NodeMessageBox>();
|
||||
m->m_title->set_text("Publish document");
|
||||
m->m_message->set_text("Would you like to upload this document to the public domain?");
|
||||
m->m_message->set_text("Would you like to upload to the public domain?");
|
||||
m->btn_ok->m_text->set_text("Yes");
|
||||
m->btn_cancel->m_text->set_text("No");
|
||||
m->btn_ok->on_click = [this, m, upload_thread](Node*) {
|
||||
|
||||
Reference in New Issue
Block a user