Added per-window user pointers.
This commit is contained in:
Родитель
37c71c1ed1
Коммит
48f5a7e763
|
@ -421,6 +421,8 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow, int x, int y);
|
|||
GLFWAPI void glfwIconifyWindow(GLFWwindow window);
|
||||
GLFWAPI void glfwRestoreWindow(GLFWwindow window);
|
||||
GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param);
|
||||
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
|
||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
|
||||
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun);
|
||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
||||
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun);
|
||||
|
|
|
@ -265,6 +265,7 @@ version of GLFW.</p>
|
|||
<li>Added <code>glfwIsWindow</code> function for verifying that a given window handle is (still) valid</li>
|
||||
<li>Added <code>glfwMakeWindowCurrent</code> function for making the context of the specified window current</li>
|
||||
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
|
||||
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
|
||||
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
|
||||
<li>Renamed <code>lib</code> source code directory to <code>src</code></li>
|
||||
<li>Replaced ad hoc build system with CMake</li>
|
||||
|
|
|
@ -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
src/window.c
32
src/window.c
|
@ -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
|
||||
//========================================================================
|
||||
|
|
Загрузка…
Ссылка в новой задаче