mirror of
https://github.com/glfw/glfw.git
synced 2026-09-20 16:30:45 +00:00
Added per-window user pointers.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
//========================================================================
|
||||
|
||||
Reference in New Issue
Block a user