fix event
This commit is contained in:
@@ -7,10 +7,7 @@ namespace VE
|
||||
application::application(std::string app_name) : m_glfw{ std::make_unique<glfw>() }
|
||||
{
|
||||
m_instance = std::unique_ptr<application>(this);
|
||||
|
||||
m_glfw->init(app_name);
|
||||
m_glfw->set_event_fn(VE_EVENT_FN);
|
||||
|
||||
m_gui = std::make_unique<gui>(m_glfw);
|
||||
}
|
||||
|
||||
@@ -42,17 +39,4 @@ namespace VE
|
||||
{
|
||||
for (auto l : m_layers_stack) l->on_attach();
|
||||
}
|
||||
|
||||
void application::set_event_fn()
|
||||
{
|
||||
for (const auto l : m_layers_stack) l->set_event_fn(VE_EVENT_FN);
|
||||
}
|
||||
|
||||
void application::on_event(event e)
|
||||
{
|
||||
if (e.is_parallele)
|
||||
for (auto l : m_layers_stack) auto future = std::async(std::launch::async, [&]() { l->on_event(e); });
|
||||
else
|
||||
for (auto l : m_layers_stack) l->on_event(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,14 +29,11 @@ namespace VE
|
||||
{
|
||||
(m_layers_stack.push_back(args), ...);
|
||||
attach_layers();
|
||||
set_event_fn();
|
||||
}
|
||||
|
||||
private:
|
||||
void clear();
|
||||
void attach_layers();
|
||||
void set_event_fn();
|
||||
void on_event(event e);
|
||||
};
|
||||
|
||||
// реализация см. в проекте
|
||||
|
||||
Reference in New Issue
Block a user