add event target
This commit is contained in:
@@ -121,7 +121,7 @@ namespace VE
|
||||
glfwSetKeyCallback(m_win, [](GLFWwindow* w, int key, int scancode, int action, int mods)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ action, key };
|
||||
event e{ event_target::VE, action, key };
|
||||
|
||||
// HERE
|
||||
// тут одноврекменно срабатывает только один сигнал
|
||||
@@ -157,7 +157,7 @@ namespace VE
|
||||
glfwSetMouseButtonCallback(m_win, [](GLFWwindow* w, int button, int action, int mods)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ action, button };
|
||||
event e{ event_target::VE, action, button };
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@@ -188,14 +188,14 @@ namespace VE
|
||||
glfwSetScrollCallback(m_win, [](GLFWwindow* w, double xOffset, double yOffset)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
|
||||
event e{ event_target::VE, event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
|
||||
d->execute(e);
|
||||
});
|
||||
|
||||
glfwSetCursorPosCallback(m_win, [](GLFWwindow* w, double xPos, double yPos)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
|
||||
event e{ event_target::VE, event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
|
||||
d->execute(e);
|
||||
});
|
||||
}
|
||||
@@ -210,21 +210,21 @@ namespace VE
|
||||
d->m_width = width;
|
||||
d->m_height = height;
|
||||
|
||||
event e{ event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
||||
event e{ event_target::VE, event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
||||
d->execute(e);
|
||||
});
|
||||
|
||||
glfwSetWindowCloseCallback(m_win, [](GLFWwindow* w)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ event_type::WINDOW_CLOSE, nullptr };
|
||||
event e{ event_target::VE, event_type::WINDOW_CLOSE, nullptr };
|
||||
d->execute(e);
|
||||
});
|
||||
|
||||
glfwSetWindowFocusCallback(m_win, [](GLFWwindow* w, int focused)
|
||||
{
|
||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||
event e{ event_type::WINDOW_FOCUS, focused };
|
||||
event e{ event_target::VE, event_type::WINDOW_FOCUS, focused };
|
||||
d->execute(e);
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace VE
|
||||
void update();
|
||||
void clear() const;
|
||||
|
||||
void set_event_fn(const event_fn<event&>& fn);
|
||||
void set_event_fn(const event_fn<event>& fn);
|
||||
|
||||
private:
|
||||
void set_hint();
|
||||
|
||||
Reference in New Issue
Block a user