remove event target

This commit is contained in:
2025-02-27 13:49:49 +03:00
parent 6a00aebb38
commit 9bef49bfe7
4 changed files with 11 additions and 15 deletions

View File

@@ -29,15 +29,11 @@ namespace VE
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;
std::any m_target;
std::any m_type;
std::any m_data;
// HERE
// как-то не прикольно так !!!
bool is_parallele{ false };
};
struct event_manager : public hack::patterns::singleton<event_manager>

View File

@@ -113,7 +113,7 @@ namespace VE
{
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
// тут одноврекменно срабатывает только один сигнал
@@ -148,7 +148,7 @@ namespace VE
{
glfwSetMouseButtonCallback(m_win, [](GLFWwindow* w, int button, int action, int mods)
{
event e{ event_target::VE, action, button };
event e{ action, button };
switch (action)
{
@@ -180,7 +180,7 @@ namespace VE
{
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);
}
catch(std::exception& e)
@@ -193,7 +193,7 @@ namespace VE
{
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);
}
catch(std::exception& e)
@@ -215,7 +215,7 @@ namespace VE
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);
}
catch(std::exception& e)
@@ -228,7 +228,7 @@ namespace VE
{
try
{
event e{ event_target::VE, event_type::WINDOW_CLOSE, nullptr };
event e{ event_type::WINDOW_CLOSE, nullptr };
VE_EMIT(e);
}
catch(std::exception& e)
@@ -241,7 +241,7 @@ namespace VE
{
try
{
event e{ event_target::VE, event_type::WINDOW_FOCUS, focused };
event e{ event_type::WINDOW_FOCUS, focused };
VE_EMIT(e);
}
catch(std::exception& e)