Added per-window user pointers.

This commit is contained in:
Camilla Berglund
2010-09-09 22:44:38 +02:00
parent 37c71c1ed1
commit 48f5a7e763
4 changed files with 36 additions and 0 deletions
+1
View File
@@ -158,6 +158,7 @@ typedef struct _GLFWwindow
GLboolean sysKeysDisabled; // system keys disabled flag
GLboolean windowNoResize; // resize- and maximize gadgets disabled flag
int refreshRate; // monitor refresh rate
void* userPointer;
// Window input state
GLboolean stickyKeys;
+32
View File
@@ -944,6 +944,38 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param)
}
//========================================================================
// Set the user pointer for the specified window
//========================================================================
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED);
return;
}
window->userPointer = pointer;
}
//========================================================================
// Get the user pointer for the specified window
//========================================================================
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED);
return;
}
return window->userPointer;
}
//========================================================================
// Set callback function for window size changes
//========================================================================