fix android view resize on keyboard, also allow all device orientations

This commit is contained in:
2019-01-29 16:35:23 +01:00
parent 58502a2457
commit b1d5bdbb8c
7 changed files with 105 additions and 31 deletions

View File

@@ -97,7 +97,7 @@ bool App::request_close()
void App::clear()
{
glClearColor(.1f, .1f, .1f, 1.f);
glViewport(0, 0, (GLsizei)width, (GLsizei)height);
glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -500,12 +500,13 @@ void App::update(float dt)
//auto box = n->m_clip;
//glm::ivec4 c = glm::vec4((int)box.x - 1, (int)(height / zoom - box.y - box.w) - 1, (int)box.z + 2, (int)box.w + 2) * zoom;
glm::ivec4 c = glm::vec4((int)box.x, (int)(height / zoom - box.y - box.w), (int)box.z, (int)box.w) * zoom;
glScissor(c.x, c.y, c.z, c.w);
glScissor(c.x + off_x, c.y + off_y, c.z, c.w);
n->draw();
return true;
}
return false;
};
/*
uirtt.bindFramebuffer();
uirtt.clear();
glEnable(GL_SCISSOR_TEST);
@@ -514,7 +515,7 @@ void App::update(float dt)
//msgbox->watch(observer);
glDisable(GL_SCISSOR_TEST);
uirtt.unbindFramebuffer();
*/
#if __IOS__
[ios_view->glview bindDrawable];
#else