big refactoring to merge node and widgets into a single node hierarchy
This commit is contained in:
@@ -132,8 +132,8 @@ void App::init()
|
||||
ShaderManager::create(kShader::UVs, shader_v, shader_uv_f);
|
||||
ShaderManager::create(kShader::Font, shader_font_v, shader_font_f);
|
||||
ShaderManager::create(kShader::Atlas, shader_atlas_v, shader_atlas_f);
|
||||
WidgetBorder::init();
|
||||
WidgetImage::init();
|
||||
NodeBorder::init();
|
||||
NodeImage::init();
|
||||
|
||||
if (!tex.load("data/uvs.jpg"))
|
||||
printf("error loading image\n");
|
||||
@@ -179,14 +179,14 @@ void App::update(float dt)
|
||||
}
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
//glEnable(GL_SCISSOR_TEST);
|
||||
for (auto& n : layout[main_id])
|
||||
{
|
||||
if (n.m_display && n.m_widget)
|
||||
if (n.m_display)
|
||||
{
|
||||
auto box = n.m_widget->clip;
|
||||
auto box = n.m_clip;
|
||||
glScissor((int)box.x, (int)(height - box.y - box.w), (int)box.z, (int)box.w);
|
||||
n.m_widget->draw();
|
||||
n.draw();
|
||||
}
|
||||
}
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
@@ -229,16 +229,25 @@ void App::resize(float w, float h)
|
||||
void App::mouse_down(int button, float x, float y)
|
||||
{
|
||||
constexpr auto main_id = const_hash("main");
|
||||
printf("mouse click %f %f\n", x, y);
|
||||
MouseEvent e;
|
||||
e.m_type = kEventType::MouseDownL;
|
||||
e.m_pos = { x, y };
|
||||
layout[main_id].on_event(&e);
|
||||
printf("mouse click %f %f\n", x, y);
|
||||
}
|
||||
void App::mouse_move(float x, float y)
|
||||
{
|
||||
|
||||
constexpr auto main_id = const_hash("main");
|
||||
MouseEvent e;
|
||||
e.m_type = kEventType::MouseMove;
|
||||
e.m_pos = { x, y };
|
||||
layout[main_id].on_event(&e);
|
||||
}
|
||||
void App::mouse_up(int button, float x, float y)
|
||||
{
|
||||
|
||||
constexpr auto main_id = const_hash("main");
|
||||
MouseEvent e;
|
||||
e.m_type = kEventType::MouseUpL;
|
||||
e.m_pos = { x, y };
|
||||
layout[main_id].on_event(&e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user