Quest controller events

This commit is contained in:
2019-06-01 17:06:33 +02:00
parent c7a2a92b52
commit 78f453f89c
3 changed files with 89 additions and 72 deletions

View File

@@ -262,18 +262,13 @@ JNIEXPORT void JNICALL Java_com_omixlab_panopainter_MainActivity_pickExternalCal
JNIEXPORT void JNICALL Java_com_omixlab_panopainter_MainActivity_contentRectChanged(JNIEnv *end, jobject,
jint wnd_w, jint wnd_h, jint rect_left, jint rect_top, jint rect_right, jint rect_bottom)
{
//if (!android_async_trylock(&g_engine))
// return;
#ifndef __QUEST__
LOG("resize wnd [%d %d] rect [%d %d %d %d]", wnd_w, wnd_h, rect_left, rect_top, rect_right, rect_bottom);
App::I.width = wnd_w;
App::I.height = (rect_bottom - rect_top);
App::I.off_x = 0;
App::I.off_y = wnd_h - (rect_bottom - rect_top);
//App::I.redraw = true;
//App::I.resize(App::I.width, App::I.height);
//g_engine.width = wnd_w;
//g_engine.height = wnd_h;
//android_async_unlock(&g_engine);
#endif
}
}
@@ -494,10 +489,6 @@ static int engine_init_display(struct engine* engine) {
engine->height = h;
engine->state.angle = 0;
float density = get_display_density(engine->app);
LOG("density %f", density);
App::I.zoom = density;// / 1.5;
g_display = display;
g_context = context;
@@ -620,17 +611,26 @@ static int engine_init_display(struct engine* engine) {
App::I.data_path = get_data_path(engine->app);
LOG("data_path %s", App::I.data_path.c_str());
App::I.width = w;
App::I.height = h;
App::I.redraw = true;
App::I.init();
#ifdef __QUEST__
App::I.resize(w, h);
App::I.zoom = 1.f;
App::I.width = 1024;
App::I.height = 1024;
App::I.redraw = true;
App::I.init();
App::I.resize(1024, 1024);
oculus_init_vr(display, context, engine->app->window);
App::I.vr_active = true;
App::I.has_vr = true;
App::I.vr_only = true;
#else
float density = get_display_density(engine->app);
LOG("density %f", density);
App::I.zoom = density;// / 1.5;
App::I.width = w;
App::I.height = h;
App::I.redraw = true;
App::I.init();
#endif
LOG("All ready");
@@ -675,7 +675,7 @@ static void engine_draw_frame(struct engine* engine) {
#ifdef __QUEST__
App::I.update(elapsed);
oculus_draw();
oculus_draw(dt.count());
#else
if (!(App::I.redraw || App::I.animate))
return;