mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 23:33:16 +01:00
Removed calling of callbacks from setters.
This commit is contained in:
@@ -456,6 +456,7 @@ static int windowCloseFun(GLFWwindow window)
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
int width, height;
|
||||
|
||||
// Initialise GLFW
|
||||
if (!glfwInit())
|
||||
@@ -464,6 +465,13 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Set callback functions
|
||||
glfwSetWindowCloseCallback(windowCloseFun);
|
||||
glfwSetWindowSizeCallback(windowSizeFun);
|
||||
glfwSetWindowRefreshCallback(windowRefreshFun);
|
||||
glfwSetCursorPosCallback(cursorPosFun);
|
||||
glfwSetMouseButtonCallback(mouseButtonFun);
|
||||
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
// Open OpenGL window
|
||||
@@ -474,6 +482,9 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
windowSizeFun(window, width, height);
|
||||
|
||||
// Enable vsync
|
||||
glfwSwapInterval(1);
|
||||
|
||||
@@ -483,13 +494,6 @@ int main(void)
|
||||
// Enable mouse cursor (only needed for fullscreen mode)
|
||||
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_NORMAL);
|
||||
|
||||
// Set callback functions
|
||||
glfwSetWindowCloseCallback(windowCloseFun);
|
||||
glfwSetWindowSizeCallback(windowSizeFun);
|
||||
glfwSetWindowRefreshCallback(windowRefreshFun);
|
||||
glfwSetCursorPosCallback(cursorPosFun);
|
||||
glfwSetMouseButtonCallback(mouseButtonFun);
|
||||
|
||||
// Main loop
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user