fix child on_attach
This commit is contained in:
@@ -35,7 +35,6 @@ namespace sandbox
|
||||
ImGui::Text("\xef\x87\xbc");
|
||||
|
||||
VE_POP_FONT();
|
||||
|
||||
}
|
||||
|
||||
void local_panel::on_event(VE::event e)
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace sandbox
|
||||
void test_panel_2::on_attach()
|
||||
{
|
||||
VE_CONNECT(test_panel_2);
|
||||
|
||||
// ATTENTION: активировать сигнальную систему в детях-компонентах
|
||||
m_local_panel.on_attach();
|
||||
hack::log()("on_attach");
|
||||
}
|
||||
|
||||
|
||||
12
bin/main.cpp
12
bin/main.cpp
@@ -1,7 +1,6 @@
|
||||
#include "layers/test_panel/test_panel.hpp"
|
||||
#include "layers/test_panel_2/test_panel_2.hpp"
|
||||
#include "layers/opengl_panel/opengl_panel.hpp"
|
||||
#include "layers/local_panel/local_panel.hpp"
|
||||
|
||||
namespace sandbox
|
||||
{
|
||||
@@ -19,19 +18,16 @@ namespace VE
|
||||
{
|
||||
static sandbox::test_app app{ "vertex_engine_sandbox" };
|
||||
|
||||
// ATTENTEION: это слои для отрисовки.
|
||||
// если делается компонент, который является составляющей этих компонентов, то
|
||||
// нужно вызывать метод on_attach внутри хозяев для работы сигнальной системы.
|
||||
// см. пример в test_panel_2
|
||||
app.push_layer(
|
||||
new sandbox::test_panel{},
|
||||
new sandbox::test_panel_2{},
|
||||
new sandbox::opengl_panel{}
|
||||
);
|
||||
|
||||
app.on_attach(
|
||||
new sandbox::test_panel{},
|
||||
new sandbox::test_panel_2{},
|
||||
new sandbox::opengl_panel{},
|
||||
new sandbox::local_panel{}
|
||||
);
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,6 @@ namespace VE
|
||||
void push_layer(Args*... args)
|
||||
{
|
||||
(m_layers_stack.push_back(args), ...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void on_attach(Args*... args)
|
||||
{
|
||||
(args->on_attach(), ...);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user