completing refactoring, something does not work on resize
This commit is contained in:
@@ -5,7 +5,7 @@ App App::I; // singleton
|
||||
|
||||
void App::create()
|
||||
{
|
||||
width = 500;
|
||||
width = 800;
|
||||
height = 500;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void App::init()
|
||||
#endif
|
||||
|
||||
layout.load("data/layout.xml");
|
||||
//layout.update(width, height);
|
||||
layout["main"].update(width, height);
|
||||
|
||||
sampler.create();
|
||||
ShaderManager::create(kShader::Texture, shader_v, shader_f);
|
||||
@@ -109,11 +109,16 @@ void App::init()
|
||||
|
||||
void App::update(float dt)
|
||||
{
|
||||
constexpr auto main_id = const_hash("main");
|
||||
|
||||
glClearColor(.1f, .1f, .1f, 1.f);
|
||||
glViewport(0, 0, (GLsizei)width, (GLsizei)height);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
layout.reload();
|
||||
if (layout.reload())
|
||||
{
|
||||
layout[main_id].update(width, height);
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
tex.bind();
|
||||
@@ -122,17 +127,16 @@ void App::update(float dt)
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
// for (auto& n : layout)
|
||||
// {
|
||||
//
|
||||
// if (n.m_widget)
|
||||
// {
|
||||
// auto box = n.m_widget->clip;
|
||||
// glScissor(box.x, height - box.y - box.w, box.z, box.w);
|
||||
// n.m_widget->draw();
|
||||
// }
|
||||
// }
|
||||
//glEnable(GL_SCISSOR_TEST);
|
||||
for (auto& n : layout[main_id])
|
||||
{
|
||||
if (n.m_widget)
|
||||
{
|
||||
auto box = n.m_widget->clip;
|
||||
glScissor(box.x, height - box.y - box.w, box.z, box.w);
|
||||
n.m_widget->draw();
|
||||
}
|
||||
}
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
tex.unbind();
|
||||
sampler.unbind();
|
||||
@@ -140,9 +144,8 @@ void App::update(float dt)
|
||||
|
||||
void App::resize(float w, float h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
// layout.update(width, height);
|
||||
constexpr auto main_id = const_hash("main");
|
||||
layout[main_id].update(w, h);
|
||||
}
|
||||
|
||||
void App::mouse_down(int button, float x, float y)
|
||||
|
||||
Reference in New Issue
Block a user