remove event target
This commit is contained in:
@@ -14,7 +14,7 @@ namespace sandbox
|
|||||||
|
|
||||||
if (ImGui::Button("RUN 2", ImVec2(28, 30)))
|
if (ImGui::Button("RUN 2", ImVec2(28, 30)))
|
||||||
{
|
{
|
||||||
VE::event e { "target_id", test_event::TEST_EVEN , std::string("test event message") };
|
VE::event e { test_event::TEST_EVEN , std::string("test event message") };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace sandbox
|
|||||||
|
|
||||||
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
|
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
|
||||||
{
|
{
|
||||||
VE::event e { "target_id", test_event::TEST_EVEN , std::string("test icon button") };
|
VE::event e { test_event::TEST_EVEN , std::string("test icon button") };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace sandbox
|
|||||||
|
|
||||||
if (ImGui::Button("RUN", ImVec2(28, 30)))
|
if (ImGui::Button("RUN", ImVec2(28, 30)))
|
||||||
{
|
{
|
||||||
VE::event e { "target_id", test_event::TEST_EVEN , std::string("test event message") };
|
VE::event e { test_event::TEST_EVEN , std::string("test event message") };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,11 @@ namespace VE
|
|||||||
|
|
||||||
struct event
|
struct event
|
||||||
{
|
{
|
||||||
event(std::any target, std::any type, std::any data) : m_target { target }, m_type{ type }, m_data{ data } {}
|
event(std::any type, std::any data) : m_type{ type }, m_data{ data } {}
|
||||||
~event() = default;
|
~event() = default;
|
||||||
|
|
||||||
std::any m_target;
|
|
||||||
std::any m_type;
|
std::any m_type;
|
||||||
std::any m_data;
|
std::any m_data;
|
||||||
// HERE
|
|
||||||
// как-то не прикольно так !!!
|
|
||||||
bool is_parallele{ false };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct event_manager : public hack::patterns::singleton<event_manager>
|
struct event_manager : public hack::patterns::singleton<event_manager>
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
glfwSetKeyCallback(m_win, [](GLFWwindow* w, int key, int scancode, int action, int mods)
|
glfwSetKeyCallback(m_win, [](GLFWwindow* w, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, action, key };
|
event e{ action, key };
|
||||||
|
|
||||||
// HERE
|
// HERE
|
||||||
// тут одноврекменно срабатывает только один сигнал
|
// тут одноврекменно срабатывает только один сигнал
|
||||||
@@ -148,7 +148,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
glfwSetMouseButtonCallback(m_win, [](GLFWwindow* w, int button, int action, int mods)
|
glfwSetMouseButtonCallback(m_win, [](GLFWwindow* w, int button, int action, int mods)
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, action, button };
|
event e{ action, button };
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@@ -180,7 +180,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
|
event e{ event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
@@ -193,7 +193,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
|
event e{ event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
@@ -215,7 +215,7 @@ namespace VE
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
event e{ event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
@@ -228,7 +228,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, event_type::WINDOW_CLOSE, nullptr };
|
event e{ event_type::WINDOW_CLOSE, nullptr };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
@@ -241,7 +241,7 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event e{ event_target::VE, event_type::WINDOW_FOCUS, focused };
|
event e{ event_type::WINDOW_FOCUS, focused };
|
||||||
VE_EMIT(e);
|
VE_EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
|
|||||||
Reference in New Issue
Block a user