add try_catch
This commit is contained in:
@@ -182,21 +182,42 @@ namespace VE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
glfwSetScrollCallback(m_win, [](GLFWwindow* w, double xOffset, double yOffset)
|
glfwSetScrollCallback(m_win, [](GLFWwindow* w, double xOffset, double yOffset)
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||||
|
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_target::VE, event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
glfwSetCursorPosCallback(m_win, [](GLFWwindow* w, double xPos, double yPos)
|
glfwSetCursorPosCallback(m_win, [](GLFWwindow* w, double xPos, double yPos)
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||||
|
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_target::VE, event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,25 +231,44 @@ namespace VE
|
|||||||
d->m_width = width;
|
d->m_width = width;
|
||||||
d->m_height = height;
|
d->m_height = height;
|
||||||
|
|
||||||
|
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_target::VE, event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
glfwSetWindowCloseCallback(m_win, [](GLFWwindow* w)
|
glfwSetWindowCloseCallback(m_win, [](GLFWwindow* w)
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||||
|
try
|
||||||
|
{
|
||||||
event e{ event_target::VE, event_type::WINDOW_CLOSE, nullptr };
|
event e{ event_target::VE, event_type::WINDOW_CLOSE, nullptr };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
glfwSetWindowFocusCallback(m_win, [](GLFWwindow* w, int focused)
|
glfwSetWindowFocusCallback(m_win, [](GLFWwindow* w, int focused)
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||||
|
try
|
||||||
|
{
|
||||||
event e{ event_target::VE, event_type::WINDOW_FOCUS, focused };
|
event e{ event_target::VE, event_type::WINDOW_FOCUS, focused };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::log()("VE_ERROR: ", e.what());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void glfw::set_opengl()
|
void glfw::set_opengl()
|
||||||
|
|||||||
Reference in New Issue
Block a user