mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Clarify pointer assertions
This commit is contained in:
parent
5fa7e2faa4
commit
de2d4c7763
@ -567,7 +567,7 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
|
|||||||
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -597,7 +597,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
assert(extension);
|
assert(extension != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
|
|
||||||
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
|
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
|
||||||
{
|
{
|
||||||
assert(procname);
|
assert(procname != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
42
src/input.c
42
src/input.c
@ -240,7 +240,7 @@ GLFWbool _glfwIsPrintable(int key)
|
|||||||
GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
|||||||
GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
|||||||
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
|||||||
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
|||||||
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
|
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = 0;
|
*xpos = 0;
|
||||||
@ -361,7 +361,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
|
|||||||
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
|
|||||||
{
|
{
|
||||||
_GLFWcursor* cursor;
|
_GLFWcursor* cursor;
|
||||||
|
|
||||||
assert(image);
|
assert(image != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) windowHandle;
|
_GLFWwindow* window = (_GLFWwindow*) windowHandle;
|
||||||
_GLFWcursor* cursor = (_GLFWcursor*) cursorHandle;
|
_GLFWcursor* cursor = (_GLFWcursor*) cursorHandle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
|
|||||||
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
|
||||||
@ -493,7 +493,7 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
|||||||
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
|
||||||
@ -503,7 +503,7 @@ GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
|||||||
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun)
|
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
|
||||||
@ -514,7 +514,7 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
|
|||||||
GLFWmousebuttonfun cbfun)
|
GLFWmousebuttonfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
|
||||||
@ -525,7 +525,7 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
|
|||||||
GLFWcursorposfun cbfun)
|
GLFWcursorposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
|
||||||
@ -536,7 +536,7 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
|
|||||||
GLFWcursorenterfun cbfun)
|
GLFWcursorenterfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
|
||||||
@ -547,7 +547,7 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
|||||||
GLFWscrollfun cbfun)
|
GLFWscrollfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
|
||||||
@ -557,7 +557,7 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
|||||||
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
|
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
|
||||||
@ -579,7 +579,7 @@ GLFWAPI int glfwJoystickPresent(int joy)
|
|||||||
|
|
||||||
GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
||||||
{
|
{
|
||||||
assert(count);
|
assert(count != NULL);
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
@ -595,7 +595,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
|
|||||||
|
|
||||||
GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
|
GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
|
||||||
{
|
{
|
||||||
assert(count);
|
assert(count != NULL);
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
@ -625,9 +625,9 @@ GLFWAPI const char* glfwGetJoystickName(int joy)
|
|||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
assert(string);
|
assert(string != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformSetClipboardString(window, string);
|
_glfwPlatformSetClipboardString(window, string);
|
||||||
@ -636,7 +636,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
|||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
return _glfwPlatformGetClipboardString(window);
|
return _glfwPlatformGetClipboardString(window);
|
||||||
|
@ -294,7 +294,7 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
|
|||||||
|
|
||||||
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
|
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
|
||||||
{
|
{
|
||||||
assert(count);
|
assert(count != NULL);
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
@ -316,7 +316,7 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
|
|||||||
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = 0;
|
*xpos = 0;
|
||||||
@ -331,7 +331,7 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
|||||||
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
|
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
if (widthMM)
|
if (widthMM)
|
||||||
*widthMM = 0;
|
*widthMM = 0;
|
||||||
@ -349,7 +349,7 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int*
|
|||||||
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
return monitor->name;
|
return monitor->name;
|
||||||
@ -365,9 +365,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
|||||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
assert(count);
|
assert(count != NULL);
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
@ -382,7 +382,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
|||||||
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
|
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
|||||||
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
@ -444,9 +444,9 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
|||||||
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
assert(monitor);
|
assert(monitor != NULL);
|
||||||
|
|
||||||
assert(ramp);
|
assert(ramp != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
@ -262,9 +262,9 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance,
|
|||||||
VkSurfaceKHR* surface)
|
VkSurfaceKHR* surface)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
assert(surface);
|
assert(surface != NULL);
|
||||||
*surface = VK_NULL_HANDLE;
|
*surface = VK_NULL_HANDLE;
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED);
|
_GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED);
|
||||||
|
56
src/window.c
56
src/window.c
@ -125,7 +125,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
_GLFWwindow* previous;
|
_GLFWwindow* previous;
|
||||||
|
|
||||||
assert(title);
|
assert(title != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
|
GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
return window->closed;
|
return window->closed;
|
||||||
@ -429,7 +429,7 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value)
|
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
window->closed = value;
|
window->closed = value;
|
||||||
@ -438,9 +438,9 @@ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value)
|
|||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
assert(title);
|
assert(title != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformSetWindowTitle(window, title);
|
_glfwPlatformSetWindowTitle(window, title);
|
||||||
@ -449,7 +449,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
|||||||
GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
|
GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = 0;
|
*xpos = 0;
|
||||||
@ -463,7 +463,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
|
|||||||
GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
|
|||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = 0;
|
*width = 0;
|
||||||
@ -494,7 +494,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
|||||||
GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
|
GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -512,7 +512,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
|
|||||||
int maxwidth, int maxheight)
|
int maxwidth, int maxheight)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
|
|||||||
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
|
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -562,7 +562,7 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle,
|
|||||||
int* right, int* bottom)
|
int* right, int* bottom)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
if (left)
|
if (left)
|
||||||
*left = 0;
|
*left = 0;
|
||||||
@ -580,7 +580,7 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle,
|
|||||||
GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformIconifyWindow(window);
|
_glfwPlatformIconifyWindow(window);
|
||||||
@ -589,7 +589,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformRestoreWindow(window);
|
_glfwPlatformRestoreWindow(window);
|
||||||
@ -605,7 +605,7 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwHideWindow(GLFWwindow* handle)
|
GLFWAPI void glfwHideWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwFocusWindow(GLFWwindow* handle)
|
GLFWAPI void glfwFocusWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ GLFWAPI void glfwFocusWindow(GLFWwindow* handle)
|
|||||||
GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
|
|
||||||
@ -690,7 +690,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
|||||||
GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
|
GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
return (GLFWmonitor*) window->monitor;
|
return (GLFWmonitor*) window->monitor;
|
||||||
@ -699,7 +699,7 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
|
|||||||
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
|
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
window->userPointer = pointer;
|
window->userPointer = pointer;
|
||||||
@ -708,7 +708,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
|
|||||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
|
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
return window->userPointer;
|
return window->userPointer;
|
||||||
@ -718,7 +718,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowposfun cbfun)
|
GLFWwindowposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun);
|
||||||
@ -729,7 +729,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowsizefun cbfun)
|
GLFWwindowsizefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.size, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.size, cbfun);
|
||||||
@ -740,7 +740,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowclosefun cbfun)
|
GLFWwindowclosefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.close, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.close, cbfun);
|
||||||
@ -751,7 +751,7 @@ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowrefreshfun cbfun)
|
GLFWwindowrefreshfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun);
|
||||||
@ -762,7 +762,7 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowfocusfun cbfun)
|
GLFWwindowfocusfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun);
|
||||||
@ -773,7 +773,7 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
|
|||||||
GLFWwindowiconifyfun cbfun)
|
GLFWwindowiconifyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun);
|
||||||
@ -784,7 +784,7 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle
|
|||||||
GLFWframebuffersizefun cbfun)
|
GLFWframebuffersizefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
assert(window);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
_GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun);
|
_GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun);
|
||||||
|
Loading…
Reference in New Issue
Block a user