The interface implemented by the platform-specific code. More...
The interface implemented by the platform-specific code.
The platform API is the interface exposed by the platform-specific code for each platform and is called by the shared code of the public API It mirrors the public API except it uses objects instead of handles.
void _glfwPlatformApplyCursorMode | ( | _GLFWwindow * | window | ) |
Applies the cursor mode of the specified window to the system.
[in] | window | The window whose cursor mode to apply. |
Definition at line 1096 of file win32_window.c.
int _glfwPlatformCreateCursor | ( | _GLFWcursor * | cursor, |
const GLFWimage * | image, | ||
int | xhot, | ||
int | yhot | ||
) |
Creates a custom cursor.
Creates a new custom cursor image that can be set for a window with glfwSetCursor. The cursor can be destroyed with glfwDestroyCursor. Any remaining cursors are destroyed by glfwTerminate.
The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel. They are arranged canonically as packed sequential rows, starting from the top-left corner.
The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
[in] | image | The desired cursor image. |
[in] | xhot | The desired x-coordinate, in pixels, of the cursor hotspot. |
[in] | yhot | The desired y-coordinate, in pixels, of the cursor hotspot. |
Definition at line 1112 of file win32_window.c.
int _glfwPlatformCreateStandardCursor | ( | _GLFWcursor * | cursor, |
int | shape | ||
) |
Creates a cursor with a standard shape.
Returns a cursor with a [standard shape](Standard cursor shapes), that can be set for a window with glfwSetCursor.
[in] | shape | One of the [standard shapes](Standard cursor shapes). |
Definition at line 1177 of file win32_window.c.
int _glfwPlatformCreateWindow | ( | _GLFWwindow * | window, |
const _GLFWwndconfig * | wndconfig, | ||
const _GLFWctxconfig * | ctxconfig, | ||
const _GLFWfbconfig * | fbconfig | ||
) |
Definition at line 797 of file win32_window.c.
void _glfwPlatformDestroyCursor | ( | _GLFWcursor * | cursor | ) |
Destroys a cursor.
This function destroys a cursor previously created with glfwCreateCursor. Any remaining cursors will be destroyed by glfwTerminate.
[in] | cursor | The cursor object to destroy. |
Definition at line 1191 of file win32_window.c.
void _glfwPlatformDestroyWindow | ( | _GLFWwindow * | window | ) |
Definition at line 853 of file win32_window.c.
int _glfwPlatformExtensionSupported | ( | const char * | extension | ) |
Returns whether the specified extension is available.
This function returns whether the specified [client API extension](context_glext) is supported by the current OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES extension and platform-specific context creation API extensions.
A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.
As this functions retrieves and searches one or more extension strings each call, it is recommended that you cache its results if it is going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.
[in] | extension | The ASCII encoded name of the extension. |
Definition at line 628 of file wgl_context.c.
const char* _glfwPlatformGetClipboardString | ( | _GLFWwindow * | window | ) |
Returns the contents of the clipboard as a string.
This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string. If the clipboard is empty or if its contents cannot be converted, `NULL` is returned and a GLFW_FORMAT_UNAVAILABLE error is generated.
[in] | window | The window that will request the clipboard contents. |
Definition at line 1264 of file win32_window.c.
Returns the window whose context is current on the calling thread.
This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread.
Definition at line 65 of file win32_tls.c.
void _glfwPlatformGetCursorPos | ( | _GLFWwindow * | window, |
double * | xpos, | ||
double * | ypos | ||
) |
Retrieves the position of the cursor relative to the client area of the window.
This function returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the client area of the specified window.
If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor position is unbounded and limited only by the minimum and maximum values of a `double`.
The coordinate can be converted to their integer equivalents with the `floor` function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.
Any or all of the position arguments may be `NULL`. If an error occurs, all non-`NULL` position arguments will be set to zero.
[in] | window | The desired window. |
[out] | xpos | Where to store the cursor x-coordinate, relative to the left edge of the client area, or `NULL`. |
[out] | ypos | Where to store the cursor y-coordinate, relative to the to top edge of the client area, or `NULL`. |
Definition at line 1069 of file win32_window.c.
void _glfwPlatformGetFramebufferSize | ( | _GLFWwindow * | window, |
int * | width, | ||
int * | height | ||
) |
Retrieves the size of the framebuffer of the specified window.
This function retrieves the size, in pixels, of the framebuffer of the specified window. If you wish to retrieve the size of the window in screen coordinates, see glfwGetWindowSize.
Any or all of the size arguments may be `NULL`. If an error occurs, all non-`NULL` size arguments will be set to zero.
[in] | window | The window whose framebuffer to query. |
[out] | width | Where to store the width, in pixels, of the framebuffer, or `NULL`. |
[out] | height | Where to store the height, in pixels, of the framebuffer, or `NULL`. |
Definition at line 921 of file win32_window.c.
void _glfwPlatformGetGammaRamp | ( | _GLFWmonitor * | monitor, |
GLFWgammaramp * | ramp | ||
) |
Returns the current gamma ramp for the specified monitor.
This function returns the current gamma ramp of the specified monitor.
[in] | monitor | The monitor to query. |
Definition at line 302 of file win32_monitor.c.
const float* _glfwPlatformGetJoystickAxes | ( | int | joy, |
int * | count | ||
) |
Returns the values of all axes of the specified joystick.
This function returns the values of all axes of the specified joystick. Each element in the array is a value between -1.0 and 1.0.
[in] | joy | The [joystick](Joysticks) to query. |
[out] | count | Where to store the number of axis values in the returned array. This is set to zero if an error occurred. |
Definition at line 84 of file winmm_joystick.c.
const unsigned char* _glfwPlatformGetJoystickButtons | ( | int | joy, |
int * | count | ||
) |
Returns the state of all buttons of the specified joystick.
This function returns the state of all buttons of the specified joystick. Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
[in] | joy | The [joystick](Joysticks) to query. |
[out] | count | Where to store the number of button states in the returned array. This is set to zero if an error occurred. |
Definition at line 117 of file winmm_joystick.c.
const char* _glfwPlatformGetJoystickName | ( | int | joy | ) |
Returns the name of the specified joystick.
This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.
[in] | joy | The [joystick](Joysticks) to query. |
Definition at line 165 of file winmm_joystick.c.
void _glfwPlatformGetMonitorPos | ( | _GLFWmonitor * | monitor, |
int * | xpos, | ||
int * | ypos | ||
) |
Returns the position of the monitor's viewport on the virtual screen.
This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
Any or all of the position arguments may be `NULL`. If an error occurs, all non-`NULL` position arguments will be set to zero.
[in] | monitor | The monitor to query. |
[out] | xpos | Where to store the monitor x-coordinate, or `NULL`. |
[out] | ypos | Where to store the monitor y-coordinate, or `NULL`. |
Definition at line 194 of file win32_monitor.c.
_GLFWmonitor** _glfwPlatformGetMonitors | ( | int * | count | ) |
Returns the currently connected monitors.
This function returns an array of handles for all currently connected monitors. The primary monitor is always first in the returned array. If no monitors were found, this function returns `NULL`.
[out] | count | Where to store the number of monitors in the returned array. This is set to zero if an error occurred. |
Definition at line 104 of file win32_monitor.c.
GLFWglproc _glfwPlatformGetProcAddress | ( | const char * | procname | ) |
Returns the address of the specified function for the current context.
This function returns the address of the specified [core or extension function](context_glext), if it is supported by the current context.
A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.
[in] | procname | The ASCII encoded name of the function. |
Definition at line 657 of file wgl_context.c.
double _glfwPlatformGetTime | ( | void | ) |
Returns the value of the GLFW timer.
This function returns the value of the GLFW timer. Unless the timer has been set using glfwSetTime, the timer measures time elapsed since GLFW was initialized.
The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds. It uses the highest-resolution monotonic time source on each supported platform.
Definition at line 75 of file win32_time.c.
const char* _glfwPlatformGetVersionString | ( | void | ) |
Returns a string describing the compile-time configuration.
This function returns the compile-time generated [version string](intro_version_string) of the GLFW library binary. It describes the version, platform, compiler and any platform-specific compile-time options.
__Do not use the version string__ to parse the GLFW library version. The glfwGetVersion function already provides the version of the running library binary.
This function always succeeds.
Definition at line 370 of file win32_init.c.
void _glfwPlatformGetVideoMode | ( | _GLFWmonitor * | monitor, |
GLFWvidmode * | mode | ||
) |
Definition at line 284 of file win32_monitor.c.
GLFWvidmode* _glfwPlatformGetVideoModes | ( | _GLFWmonitor * | monitor, |
int * | count | ||
) |
Returns the available video modes for the specified monitor.
This function returns an array of all video modes supported by the specified monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths) and then by resolution area (the product of width and height).
[in] | monitor | The monitor to query. |
[out] | count | Where to store the number of video modes in the returned array. This is set to zero if an error occurred. |
Definition at line 211 of file win32_monitor.c.
void _glfwPlatformGetWindowFrameSize | ( | _GLFWwindow * | window, |
int * | left, | ||
int * | top, | ||
int * | right, | ||
int * | bottom | ||
) |
Retrieves the size of the frame of the window.
This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the [window-related hints](window_hints_wnd) used to create it.
Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.
Any or all of the size arguments may be `NULL`. If an error occurs, all non-`NULL` size arguments will be set to zero.
[in] | window | The window whose frame size to query. |
[out] | left | Where to store the size, in screen coordinates, of the left edge of the window frame, or `NULL`. |
[out] | top | Where to store the size, in screen coordinates, of the top edge of the window frame, or `NULL`. |
[out] | right | Where to store the size, in screen coordinates, of the right edge of the window frame, or `NULL`. |
[out] | bottom | Where to store the size, in screen coordinates, of the bottom edge of the window frame, or `NULL`. |
Definition at line 926 of file win32_window.c.
void _glfwPlatformGetWindowPos | ( | _GLFWwindow * | window, |
int * | xpos, | ||
int * | ypos | ||
) |
Retrieves the position of the client area of the specified window.
This function retrieves the position, in screen coordinates, of the upper-left corner of the client area of the specified window.
Any or all of the position arguments may be `NULL`. If an error occurs, all non-`NULL` position arguments will be set to zero.
[in] | window | The window to query. |
[out] | xpos | Where to store the x-coordinate of the upper-left corner of the client area, or `NULL`. |
[out] | ypos | Where to store the y-coordinate of the upper-left corner of the client area, or `NULL`. |
Definition at line 875 of file win32_window.c.
void _glfwPlatformGetWindowSize | ( | _GLFWwindow * | window, |
int * | width, | ||
int * | height | ||
) |
Retrieves the size of the client area of the specified window.
This function retrieves the size, in screen coordinates, of the client area of the specified window. If you wish to retrieve the size of the framebuffer of the window in pixels, see glfwGetFramebufferSize.
Any or all of the size arguments may be `NULL`. If an error occurs, all non-`NULL` size arguments will be set to zero.
[in] | window | The window whose size to retrieve. |
[out] | width | Where to store the width, in screen coordinates, of the client area, or `NULL`. |
[out] | height | Where to store the height, in screen coordinates, of the client area, or `NULL`. |
Definition at line 895 of file win32_window.c.
void _glfwPlatformHideWindow | ( | _GLFWwindow * | window | ) |
Hides the specified window.
This function hides the specified window if it was previously visible. If the window is already hidden or is in full screen mode, this function does nothing.
[in] | window | The window to hide. |
Definition at line 971 of file win32_window.c.
void _glfwPlatformIconifyWindow | ( | _GLFWwindow * | window | ) |
Iconifies the specified window.
This function iconifies (minimizes) the specified window if it was previously restored. If the window is already iconified, this function does nothing.
If the specified window is a full screen window, the original monitor resolution is restored until the window is restored.
[in] | window | The window to iconify. |
Definition at line 948 of file win32_window.c.
int _glfwPlatformInit | ( | void | ) |
Initializes the platform-specific part of the library.
Definition at line 324 of file win32_init.c.
GLboolean _glfwPlatformIsSameMonitor | ( | _GLFWmonitor * | first, |
_GLFWmonitor * | second | ||
) |
Checks whether two monitor objects represent the same monitor.
[in] | first | The first monitor. |
[in] | second | The second monitor. |
GL_TRUE
if the monitor objects represent the same monitor, or GL_FALSE
otherwise. Definition at line 189 of file win32_monitor.c.
int _glfwPlatformJoystickPresent | ( | int | joy | ) |
Returns whether the specified joystick is present.
This function returns whether the specified joystick is present.
[in] | joy | The [joystick](Joysticks) to query. |
Definition at line 74 of file winmm_joystick.c.
void _glfwPlatformMakeContextCurrent | ( | _GLFWwindow * | window | ) |
Makes the context of the specified window current for the calling thread.
This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread. A context can only be made current on a single thread at a time and each thread can have only a single current context at a time.
By default, making a context non-current implicitly forces a pipeline flush. On machines that support `GL_KHR_context_flush_control`, you can control whether a context performs this flush by setting the [GLFW_CONTEXT_RELEASE_BEHAVIOR](window_hints_ctx) window hint.
[in] | window | The window whose context to make current, or `NULL` to detach the current context. |
Definition at line 590 of file wgl_context.c.
Processes all pending events.
This function processes only those events that are already in the event queue and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the [window refresh callback](window_refresh) to redraw the contents of your window when necessary during such operations.
On some platforms, certain events are sent directly to the application without going through the event queue, causing callbacks to be called outside of a call to one of the event processing functions.
Event processing is not required for joystick input to work.
Definition at line 991 of file win32_window.c.
Posts an empty event to the event queue.
This function posts an empty event from the current thread to the event queue, causing glfwWaitEvents to return.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use your threading library of choice.
Definition at line 1063 of file win32_window.c.
void _glfwPlatformRestoreWindow | ( | _GLFWwindow * | window | ) |
Restores the specified window.
This function restores the specified window if it was previously iconified (minimized). If the window is already restored, this function does nothing.
If the specified window is a full screen window, the resolution chosen for the window is restored on the selected monitor.
[in] | window | The window to restore. |
Definition at line 953 of file win32_window.c.
void _glfwPlatformSetClipboardString | ( | _GLFWwindow * | window, |
const char * | string | ||
) |
Sets the clipboard to the specified string.
This function sets the system clipboard to the specified, UTF-8 encoded string.
[in] | window | The window that will own the clipboard contents. |
[in] | string | A UTF-8 encoded string. |
Definition at line 1219 of file win32_window.c.
void _glfwPlatformSetCursor | ( | _GLFWwindow * | window, |
_GLFWcursor * | cursor | ||
) |
Sets the cursor for the window.
This function sets the cursor image to be used when the cursor is over the client area of the specified window. The set cursor will only be visible when the [cursor mode](cursor_mode) of the window is `GLFW_CURSOR_NORMAL`.
On some platforms, the set cursor may not be visible unless the window also has input focus.
[in] | window | The window to set the cursor for. |
[in] | cursor | The cursor to set, or `NULL` to switch back to the default arrow cursor. |
Definition at line 1197 of file win32_window.c.
void _glfwPlatformSetCursorPos | ( | _GLFWwindow * | window, |
double | xpos, | ||
double | ypos | ||
) |
Sets the position of the cursor, relative to the client area of the window.
This function sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the client area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.
__Do not use this function__ to implement things like camera controls. GLFW already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the cursor, transparently re-centers it and provides unconstrained cursor motion. See glfwSetInputMode for more information.
If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is unconstrained and limited only by the minimum and maximum values of a `double`.
[in] | window | The desired window. |
[in] | xpos | The desired x-coordinate, relative to the left edge of the client area. |
[in] | ypos | The desired y-coordinate, relative to the top edge of the client area. |
Definition at line 1084 of file win32_window.c.
void _glfwPlatformSetGammaRamp | ( | _GLFWmonitor * | monitor, |
const GLFWgammaramp * | ramp | ||
) |
Sets the current gamma ramp for the specified monitor.
This function sets the current gamma ramp for the specified monitor. The original gamma ramp for that monitor is saved by GLFW the first time this function is called and is restored by glfwTerminate.
[in] | monitor | The monitor whose gamma ramp to set. |
[in] | ramp | The gamma ramp to use. |
Definition at line 318 of file win32_monitor.c.
void _glfwPlatformSetTime | ( | double | time | ) |
Sets the GLFW timer.
This function sets the value of the GLFW timer. It then continues to count up from that value. The value must be a positive finite number less than or equal to 18446744073.0, which is approximately 584.5 years.
[in] | time | The new value, in seconds. |
Definition at line 81 of file win32_time.c.
void _glfwPlatformSetWindowPos | ( | _GLFWwindow * | window, |
int | xpos, | ||
int | ypos | ||
) |
Sets the position of the client area of the specified window.
This function sets the position, in screen coordinates, of the upper-left corner of the client area of the specified windowed mode window. If the window is a full screen window, this function does nothing.
__Do not use this function__ to move an already visible window unless you have very good reasons for doing so, as it will confuse and annoy the user.
The window manager may put limits on what positions are allowed. GLFW cannot and should not override these limits.
[in] | window | The window to query. |
[in] | xpos | The x-coordinate of the upper-left corner of the client area. |
[in] | ypos | The y-coordinate of the upper-left corner of the client area. |
Definition at line 886 of file win32_window.c.
void _glfwPlatformSetWindowSize | ( | _GLFWwindow * | window, |
int | width, | ||
int | height | ||
) |
Sets the size of the client area of the specified window.
This function sets the size, in screen coordinates, of the client area of the specified window.
For full screen windows, this function selects and switches to the resolution closest to the specified size, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.
The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.
[in] | window | The window to resize. |
[in] | width | The desired width of the specified window. |
[in] | height | The desired height of the specified window. |
Definition at line 906 of file win32_window.c.
void _glfwPlatformSetWindowTitle | ( | _GLFWwindow * | window, |
const char * | title | ||
) |
Sets the title of the specified window.
This function sets the window title, encoded as UTF-8, of the specified window.
[in] | window | The window whose title to change. |
[in] | title | The UTF-8 encoded window title. |
Definition at line 861 of file win32_window.c.
void _glfwPlatformShowWindow | ( | _GLFWwindow * | window | ) |
Makes the specified window visible.
This function makes the specified window visible if it was previously hidden. If the window is already visible or is in full screen mode, this function does nothing.
[in] | window | The window to make visible. |
Definition at line 958 of file win32_window.c.
void _glfwPlatformSwapBuffers | ( | _GLFWwindow * | window | ) |
Swaps the front and back buffers of the specified window.
This function swaps the front and back buffers of the specified window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.
[in] | window | The window whose buffers to swap. |
Definition at line 600 of file wgl_context.c.
void _glfwPlatformSwapInterval | ( | int | interval | ) |
Sets the swap interval for the current context.
This function sets the swap interval for the current context, i.e. the number of screen updates to wait from the time glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called _vertical synchronization_, _vertical retrace synchronization_ or just _vsync_.
Contexts that support either of the `WGL_EXT_swap_control_tear` and `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, which allow the driver to swap even if a frame arrives a little bit late. You can check for the presence of these extensions using glfwExtensionSupported. For more information about swap tearing, see the extension specifications.
A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.
[in] | interval | The minimum number of screen updates to wait for until the buffers are swapped by glfwSwapBuffers. |
Definition at line 613 of file wgl_context.c.
Terminates the platform-specific part of the library.
Definition at line 354 of file win32_init.c.
void _glfwPlatformUnhideWindow | ( | _GLFWwindow * | window | ) |
Definition at line 966 of file win32_window.c.
Waits until events are queued and processes them.
This function puts the calling thread to sleep until at least one event is available in the event queue. Once one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.
On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the [window refresh callback](window_refresh) to redraw the contents of your window when necessary during such operations.
On some platforms, certain callbacks may be called outside of a call to one of the event processing functions.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use your threading library of choice.
Event processing is not required for joystick input to work.
Definition at line 1056 of file win32_window.c.
int _glfwPlatformWindowFocused | ( | _GLFWwindow * | window | ) |
Returns whether the window is focused.
Definition at line 976 of file win32_window.c.
int _glfwPlatformWindowIconified | ( | _GLFWwindow * | window | ) |
Returns whether the window is iconified.
Definition at line 981 of file win32_window.c.
int _glfwPlatformWindowVisible | ( | _GLFWwindow * | window | ) |
Returns whether the window is visible.
Definition at line 986 of file win32_window.c.