text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<title>GLFW: Window reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Community

Macros |
Typedefs |
Functions

Window reference

Description

This is the reference documentation for window related functions and types, including creation, deletion and event polling. For more task-oriented information, see the Window guide.

Macros

#define 	GLFW_FOCUSED   0x00020001

 	Input focus window hint and attribute.  More...

#define 	GLFW_ICONIFIED   0x00020002

 	Window iconification window attribute.  More...

#define 	GLFW_RESIZABLE   0x00020003

 	Window resize-ability window hint and attribute.  More...

#define 	GLFW_VISIBLE   0x00020004

 	Window visibility window hint and attribute.  More...

#define 	GLFW_DECORATED   0x00020005

 	Window decoration window hint and attribute.  More...

#define 	GLFW_AUTO_ICONIFY   0x00020006

 	Window auto-iconification window hint and attribute.  More...

#define 	GLFW_FLOATING   0x00020007

 	Window decoration window hint and attribute.  More...

#define 	GLFW_MAXIMIZED   0x00020008

 	Window maximization window hint and attribute.  More...

#define 	GLFW_CENTER_CURSOR   0x00020009

 	Cursor centering window hint.  More...

#define 	GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A

 	Window framebuffer transparency hint and attribute.  More...

#define 	GLFW_HOVERED   0x0002000B

 	Mouse cursor hover window attribute.  More...

#define 	GLFW_FOCUS_ON_SHOW   0x0002000C

 	Input focus on calling show window hint and attribute.  More...

#define 	GLFW_RED_BITS   0x00021001

 	Framebuffer bit depth hint.  More...

#define 	GLFW_GREEN_BITS   0x00021002

 	Framebuffer bit depth hint.  More...

#define 	GLFW_BLUE_BITS   0x00021003

 	Framebuffer bit depth hint.  More...

#define 	GLFW_ALPHA_BITS   0x00021004

 	Framebuffer bit depth hint.  More...

#define 	GLFW_DEPTH_BITS   0x00021005

 	Framebuffer bit depth hint.  More...

#define 	GLFW_STENCIL_BITS   0x00021006

 	Framebuffer bit depth hint.  More...

#define 	GLFW_ACCUM_RED_BITS   0x00021007

 	Framebuffer bit depth hint.  More...

#define 	GLFW_ACCUM_GREEN_BITS   0x00021008

 	Framebuffer bit depth hint.  More...

#define 	GLFW_ACCUM_BLUE_BITS   0x00021009

 	Framebuffer bit depth hint.  More...

#define 	GLFW_ACCUM_ALPHA_BITS   0x0002100A

 	Framebuffer bit depth hint.  More...

#define 	GLFW_AUX_BUFFERS   0x0002100B

 	Framebuffer auxiliary buffer hint.  More...

#define 	GLFW_STEREO   0x0002100C

 	OpenGL stereoscopic rendering hint.  More...

#define 	GLFW_SAMPLES   0x0002100D

 	Framebuffer MSAA samples hint.  More...

#define 	GLFW_SRGB_CAPABLE   0x0002100E

 	Framebuffer sRGB hint.  More...

#define 	GLFW_REFRESH_RATE   0x0002100F

 	Monitor refresh rate hint.  More...

#define 	GLFW_DOUBLEBUFFER   0x00021010

 	Framebuffer double buffering hint.  More...

#define 	GLFW_CLIENT_API   0x00022001

 	Context client API hint and attribute.  More...

#define 	GLFW_CONTEXT_VERSION_MAJOR   0x00022002

 	Context client API major version hint and attribute.  More...

#define 	GLFW_CONTEXT_VERSION_MINOR   0x00022003

 	Context client API minor version hint and attribute.  More...

#define 	GLFW_CONTEXT_REVISION   0x00022004

 	Context client API revision number hint and attribute.  More...

#define 	GLFW_CONTEXT_ROBUSTNESS   0x00022005

 	Context robustness hint and attribute.  More...

#define 	GLFW_OPENGL_FORWARD_COMPAT   0x00022006

 	OpenGL forward-compatibility hint and attribute.  More...

#define 	GLFW_OPENGL_DEBUG_CONTEXT   0x00022007

 	OpenGL debug context hint and attribute.  More...

#define 	GLFW_OPENGL_PROFILE   0x00022008

 	OpenGL profile hint and attribute.  More...

#define 	GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009

 	Context flush-on-release hint and attribute.  More...

#define 	GLFW_CONTEXT_NO_ERROR   0x0002200A

 	Context error suppression hint and attribute.  More...

#define 	GLFW_CONTEXT_CREATION_API   0x0002200B

 	Context creation API hint and attribute.  More...

#define 	GLFW_SCALE_TO_MONITOR   0x0002200C

 	Window content area scaling window window hint.  More...

#define 	GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001

 	macOS specific window hint.  More...

#define 	GLFW_COCOA_FRAME_NAME   0x00023002

 	macOS specific window hint.  More...

#define 	GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003

 	macOS specific window hint.  More...

#define 	GLFW_X11_CLASS_NAME   0x00024001

 	X11 specific window hint.  More...

#define 	GLFW_X11_INSTANCE_NAME   0x00024002

 	X11 specific window hint.  More...

Typedefs

typedef struct GLFWwindow 	GLFWwindow

 	Opaque window object.  More...

typedef void(* 	GLFWwindowposfun) (GLFWwindow *, int, int)

 	The function pointer type for window position callbacks.  More...

typedef void(* 	GLFWwindowsizefun) (GLFWwindow *, int, int)

 	The function pointer type for window size callbacks.  More...

typedef void(* 	GLFWwindowclosefun) (GLFWwindow *)

 	The function pointer type for window close callbacks.  More...

typedef void(* 	GLFWwindowrefreshfun) (GLFWwindow *)

 	The function pointer type for window content refresh callbacks.  More...

typedef void(* 	GLFWwindowfocusfun) (GLFWwindow *, int)

 	The function pointer type for window focus callbacks.  More...

typedef void(* 	GLFWwindowiconifyfun) (GLFWwindow *, int)

 	The function pointer type for window iconify callbacks.  More...

typedef void(* 	GLFWwindowmaximizefun) (GLFWwindow *, int)

 	The function pointer type for window maximize callbacks.  More...

typedef void(* 	GLFWframebuffersizefun) (GLFWwindow *, int, int)

 	The function pointer type for framebuffer size callbacks.  More...

typedef void(* 	GLFWwindowcontentscalefun) (GLFWwindow *, float, float)

 	The function pointer type for window content scale callbacks.  More...

typedef struct GLFWimage 	GLFWimage

 	Image data.  More...

Functions

void 	glfwDefaultWindowHints (void)

 	Resets all window hints to their default values.  More...

void 	glfwWindowHint (int hint, int value)

 	Sets the specified window hint to the desired value.  More...

void 	glfwWindowHintString (int hint, const char *value)

 	Sets the specified window hint to the desired value.  More...

GLFWwindow * 	glfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)

 	Creates a window and its associated context.  More...

void 	glfwDestroyWindow (GLFWwindow *window)

 	Destroys the specified window and its context.  More...

int 	glfwWindowShouldClose (GLFWwindow *window)

 	Checks the close flag of the specified window.  More...

void 	glfwSetWindowShouldClose (GLFWwindow *window, int value)

 	Sets the close flag of the specified window.  More...

void 	glfwSetWindowTitle (GLFWwindow *window, const char *title)

 	Sets the title of the specified window.  More...

void 	glfwSetWindowIcon (GLFWwindow *window, int count, const GLFWimage *images)

 	Sets the icon for the specified window.  More...

void 	glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos)

 	Retrieves the position of the content area of the specified window.  More...

void 	glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos)

 	Sets the position of the content area of the specified window.  More...

void 	glfwGetWindowSize (GLFWwindow *window, int *width, int *height)

 	Retrieves the size of the content area of the specified window.  More...

void 	glfwSetWindowSizeLimits (GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)

 	Sets the size limits of the specified window.  More...

void 	glfwSetWindowAspectRatio (GLFWwindow *window, int numer, int denom)

 	Sets the aspect ratio of the specified window.  More...

void 	glfwSetWindowSize (GLFWwindow *window, int width, int height)

 	Sets the size of the content area of the specified window.  More...

void 	glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height)

 	Retrieves the size of the framebuffer of the specified window.  More...

void 	glfwGetWindowFrameSize (GLFWwindow *window, int *left, int *top, int *right, int *bottom)

 	Retrieves the size of the frame of the window.  More...

void 	glfwGetWindowContentScale (GLFWwindow *window, float *xscale, float *yscale)

 	Retrieves the content scale for the specified window.  More...

float 	glfwGetWindowOpacity (GLFWwindow *window)

 	Returns the opacity of the whole window.  More...

void 	glfwSetWindowOpacity (GLFWwindow *window, float opacity)

 	Sets the opacity of the whole window.  More...

void 	glfwIconifyWindow (GLFWwindow *window)

 	Iconifies the specified window.  More...

void 	glfwRestoreWindow (GLFWwindow *window)

 	Restores the specified window.  More...

void 	glfwMaximizeWindow (GLFWwindow *window)

 	Maximizes the specified window.  More...

void 	glfwShowWindow (GLFWwindow *window)

 	Makes the specified window visible.  More...

void 	glfwHideWindow (GLFWwindow *window)

 	Hides the specified window.  More...

void 	glfwFocusWindow (GLFWwindow *window)

 	Brings the specified window to front and sets input focus.  More...

void 	glfwRequestWindowAttention (GLFWwindow *window)

 	Requests user attention to the specified window.  More...

GLFWmonitor * 	glfwGetWindowMonitor (GLFWwindow *window)

 	Returns the monitor that the window uses for full screen mode.  More...

void 	glfwSetWindowMonitor (GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)

 	Sets the mode, monitor, video mode and placement of a window.  More...

int 	glfwGetWindowAttrib (GLFWwindow *window, int attrib)

 	Returns an attribute of the specified window.  More...

void 	glfwSetWindowAttrib (GLFWwindow *window, int attrib, int value)

 	Sets an attribute of the specified window.  More...

void 	glfwSetWindowUserPointer (GLFWwindow *window, void *pointer)

 	Sets the user pointer of the specified window.  More...

void * 	glfwGetWindowUserPointer (GLFWwindow *window)

 	Returns the user pointer of the specified window.  More...

GLFWwindowposfun 	glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun callback)

 	Sets the position callback for the specified window.  More...

GLFWwindowsizefun 	glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun callback)

 	Sets the size callback for the specified window.  More...

GLFWwindowclosefun 	glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun callback)

 	Sets the close callback for the specified window.  More...

GLFWwindowrefreshfun 	glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun callback)

 	Sets the refresh callback for the specified window.  More...

GLFWwindowfocusfun 	glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun callback)

 	Sets the focus callback for the specified window.  More...

GLFWwindowiconifyfun 	glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun callback)

 	Sets the iconify callback for the specified window.  More...

GLFWwindowmaximizefun 	glfwSetWindowMaximizeCallback (GLFWwindow *window, GLFWwindowmaximizefun callback)

 	Sets the maximize callback for the specified window.  More...

GLFWframebuffersizefun 	glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun callback)

 	Sets the framebuffer resize callback for the specified window.  More...

GLFWwindowcontentscalefun 	glfwSetWindowContentScaleCallback (GLFWwindow *window, GLFWwindowcontentscalefun callback)

 	Sets the window content scale callback for the specified window.  More...

void 	glfwPollEvents (void)

 	Processes all pending events.  More...

void 	glfwWaitEvents (void)

 	Waits until events are queued and processes them.  More...

void 	glfwWaitEventsTimeout (double timeout)

 	Waits with timeout until events are queued and processes them.  More...

void 	glfwPostEmptyEvent (void)

 	Posts an empty event to the event queue.  More...

void 	glfwSwapBuffers (GLFWwindow *window)

 	Swaps the front and back buffers of the specified window.  More...

Macro Definition Documentation

◆ GLFW_FOCUSED

          #define GLFW_FOCUSED   0x00020001

Input focus window hint or window attribute.

◆ GLFW_ICONIFIED

          #define GLFW_ICONIFIED   0x00020002

Window iconification window attribute.

◆ GLFW_RESIZABLE

          #define GLFW_RESIZABLE   0x00020003

Window resize-ability window hint and window attribute.

◆ GLFW_VISIBLE

          #define GLFW_VISIBLE   0x00020004

Window visibility window hint and window attribute.

◆ GLFW_DECORATED

          #define GLFW_DECORATED   0x00020005

Window decoration window hint and window attribute.

◆ GLFW_AUTO_ICONIFY

          #define GLFW_AUTO_ICONIFY   0x00020006

Window auto-iconification window hint and window attribute.

◆ GLFW_FLOATING

          #define GLFW_FLOATING   0x00020007

Window decoration window hint and window attribute.

◆ GLFW_MAXIMIZED

          #define GLFW_MAXIMIZED   0x00020008

Window maximization window hint and window attribute.

◆ GLFW_CENTER_CURSOR

          #define GLFW_CENTER_CURSOR   0x00020009

Cursor centering window hint.

◆ GLFW_TRANSPARENT_FRAMEBUFFER

          #define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A

Window framebuffer transparency window hint and window attribute.

◆ GLFW_HOVERED

          #define GLFW_HOVERED   0x0002000B

Mouse cursor hover window attribute.

◆ GLFW_FOCUS_ON_SHOW

          #define GLFW_FOCUS_ON_SHOW   0x0002000C

Input focus window hint or window attribute.

◆ GLFW_RED_BITS

          #define GLFW_RED_BITS   0x00021001

Framebuffer bit depth hint.

◆ GLFW_GREEN_BITS

          #define GLFW_GREEN_BITS   0x00021002

Framebuffer bit depth hint.

◆ GLFW_BLUE_BITS

          #define GLFW_BLUE_BITS   0x00021003

Framebuffer bit depth hint.

◆ GLFW_ALPHA_BITS

          #define GLFW_ALPHA_BITS   0x00021004

Framebuffer bit depth hint.

◆ GLFW_DEPTH_BITS

          #define GLFW_DEPTH_BITS   0x00021005

Framebuffer bit depth hint.

◆ GLFW_STENCIL_BITS

          #define GLFW_STENCIL_BITS   0x00021006

Framebuffer bit depth hint.

◆ GLFW_ACCUM_RED_BITS

          #define GLFW_ACCUM_RED_BITS   0x00021007

Framebuffer bit depth hint.

◆ GLFW_ACCUM_GREEN_BITS

          #define GLFW_ACCUM_GREEN_BITS   0x00021008

Framebuffer bit depth hint.

◆ GLFW_ACCUM_BLUE_BITS

          #define GLFW_ACCUM_BLUE_BITS   0x00021009

Framebuffer bit depth hint.

◆ GLFW_ACCUM_ALPHA_BITS

          #define GLFW_ACCUM_ALPHA_BITS   0x0002100A

Framebuffer bit depth hint.

◆ GLFW_AUX_BUFFERS

          #define GLFW_AUX_BUFFERS   0x0002100B

Framebuffer auxiliary buffer hint.

◆ GLFW_STEREO

          #define GLFW_STEREO   0x0002100C

OpenGL stereoscopic rendering hint.

◆ GLFW_SAMPLES

          #define GLFW_SAMPLES   0x0002100D

Framebuffer MSAA samples hint.

◆ GLFW_SRGB_CAPABLE

          #define GLFW_SRGB_CAPABLE   0x0002100E

Framebuffer sRGB hint.

◆ GLFW_REFRESH_RATE

          #define GLFW_REFRESH_RATE   0x0002100F

Monitor refresh rate hint.

◆ GLFW_DOUBLEBUFFER

          #define GLFW_DOUBLEBUFFER   0x00021010

Framebuffer double buffering hint.

◆ GLFW_CLIENT_API

          #define GLFW_CLIENT_API   0x00022001

Context client API hint and attribute.

◆ GLFW_CONTEXT_VERSION_MAJOR

          #define GLFW_CONTEXT_VERSION_MAJOR   0x00022002

Context client API major version hint and attribute.

◆ GLFW_CONTEXT_VERSION_MINOR

          #define GLFW_CONTEXT_VERSION_MINOR   0x00022003

Context client API minor version hint and attribute.

◆ GLFW_CONTEXT_REVISION

          #define GLFW_CONTEXT_REVISION   0x00022004

Context client API revision number attribute.

◆ GLFW_CONTEXT_ROBUSTNESS

          #define GLFW_CONTEXT_ROBUSTNESS   0x00022005

Context client API revision number hint and attribute.

◆ GLFW_OPENGL_FORWARD_COMPAT

          #define GLFW_OPENGL_FORWARD_COMPAT   0x00022006

OpenGL forward-compatibility hint and attribute.

◆ GLFW_OPENGL_DEBUG_CONTEXT

          #define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007

OpenGL debug context hint and attribute.

◆ GLFW_OPENGL_PROFILE

          #define GLFW_OPENGL_PROFILE   0x00022008

OpenGL profile hint and attribute.

◆ GLFW_CONTEXT_RELEASE_BEHAVIOR

          #define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009

Context flush-on-release hint and attribute.

◆ GLFW_CONTEXT_NO_ERROR

          #define GLFW_CONTEXT_NO_ERROR   0x0002200A

Context error suppression hint and attribute.

◆ GLFW_CONTEXT_CREATION_API

          #define GLFW_CONTEXT_CREATION_API   0x0002200B

Context creation API hint and attribute.

◆ GLFW_SCALE_TO_MONITOR

          #define GLFW_SCALE_TO_MONITOR   0x0002200C

◆ GLFW_COCOA_RETINA_FRAMEBUFFER

          #define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001

◆ GLFW_COCOA_FRAME_NAME

          #define GLFW_COCOA_FRAME_NAME   0x00023002

◆ GLFW_COCOA_GRAPHICS_SWITCHING

          #define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003

◆ GLFW_X11_CLASS_NAME

          #define GLFW_X11_CLASS_NAME   0x00024001

◆ GLFW_X11_INSTANCE_NAME

          #define GLFW_X11_INSTANCE_NAME   0x00024002

Typedef Documentation

◆ GLFWwindow

          typedef struct GLFWwindow GLFWwindow

Opaque window object.

See also

Window objects

Since

Added in version 3.0.

◆ GLFWwindowposfun

          typedef void(*  GLFWwindowposfun) (GLFWwindow *, int, int)

This is the function pointer type for window position callbacks. A window position callback function has the following signature:

void callback_name(GLFWwindow* window, int xpos, int ypos)

Parameters

[in]	window	The window that was moved.

[in]	xpos	The new x-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.

[in]	ypos	The new y-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.

See also

Window position

glfwSetWindowPosCallback

Since

Added in version 3.0.

◆ GLFWwindowsizefun

          typedef void(*  GLFWwindowsizefun) (GLFWwindow *, int, int)

This is the function pointer type for window size callbacks. A window size callback function has the following signature:

void callback_name(GLFWwindow* window, int width, int height)

Parameters

[in]	window	The window that was resized.

[in]	width	The new width, in screen coordinates, of the window.

[in]	height	The new height, in screen coordinates, of the window.

See also

Window size

glfwSetWindowSizeCallback

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

◆ GLFWwindowclosefun

          typedef void(*  GLFWwindowclosefun) (GLFWwindow *)

This is the function pointer type for window close callbacks. A window close callback function has the following signature:

void function_name(GLFWwindow* window)

Parameters

[in]	window	The window that the user attempted to close.

See also

Window closing and close flag

glfwSetWindowCloseCallback

Since

Added in version 2.5. GLFW 3: Added window handle parameter.

◆ GLFWwindowrefreshfun

          typedef void(*  GLFWwindowrefreshfun) (GLFWwindow *)

This is the function pointer type for window content refresh callbacks. A window content refresh callback function has the following signature:

void function_name(GLFWwindow* window);

Parameters

[in]	window	The window whose content needs to be refreshed.

See also

Window damage and refresh

glfwSetWindowRefreshCallback

Since

Added in version 2.5. GLFW 3: Added window handle parameter.

◆ GLFWwindowfocusfun

          typedef void(*  GLFWwindowfocusfun) (GLFWwindow *, int)

This is the function pointer type for window focus callbacks. A window focus callback function has the following signature:

void function_name(GLFWwindow* window, int focused)

Parameters

[in]	window	The window that gained or lost input focus.

[in]	focused	GLFW_TRUE if the window was given input focus, or GLFW_FALSE if it lost it.

See also

Window input focus

glfwSetWindowFocusCallback

Since

Added in version 3.0.

◆ GLFWwindowiconifyfun

          typedef void(*  GLFWwindowiconifyfun) (GLFWwindow *, int)

This is the function pointer type for window iconify callbacks. A window iconify callback function has the following signature:

void function_name(GLFWwindow* window, int iconified)

Parameters

[in]	window	The window that was iconified or restored.

[in]	iconified	GLFW_TRUE if the window was iconified, or GLFW_FALSE if it was restored.

See also

Window iconification

glfwSetWindowIconifyCallback

Since

Added in version 3.0.

◆ GLFWwindowmaximizefun

          typedef void(*  GLFWwindowmaximizefun) (GLFWwindow *, int)

This is the function pointer type for window maximize callbacks. A window maximize callback function has the following signature:

void function_name(GLFWwindow* window, int maximized)

Parameters

[in]	window	The window that was maximized or restored.

[in]	iconified	GLFW_TRUE if the window was maximized, or GLFW_FALSE if it was restored.

See also

Window maximization

glfwSetWindowMaximizeCallback

Since

Added in version 3.3.

◆ GLFWframebuffersizefun

          typedef void(*  GLFWframebuffersizefun) (GLFWwindow *, int, int)

This is the function pointer type for framebuffer size callbacks. A framebuffer size callback function has the following signature:

void function_name(GLFWwindow* window, int width, int height)

Parameters

[in]	window	The window whose framebuffer was resized.

[in]	width	The new width, in pixels, of the framebuffer.

[in]	height	The new height, in pixels, of the framebuffer.

See also

Framebuffer size

glfwSetFramebufferSizeCallback

Since

Added in version 3.0.

◆ GLFWwindowcontentscalefun

          typedef void(*  GLFWwindowcontentscalefun) (GLFWwindow *, float, float)

This is the function pointer type for window content scale callbacks. A window content scale callback function has the following signature:

void function_name(GLFWwindow* window, float xscale, float yscale)

Parameters

[in]	window	The window whose content scale changed.

[in]	xscale	The new x-axis content scale of the window.

[in]	yscale	The new y-axis content scale of the window.

See also

Window content scale

glfwSetWindowContentScaleCallback

Since

Added in version 3.3.

◆ GLFWimage

          typedef struct GLFWimage  GLFWimage

This describes a single 2D image. See the documentation for each related function what the expected pixel format is.

See also

Custom cursor creation

Window icon

Since

Added in version 2.1. GLFW 3: Removed format and bytes-per-pixel members.

Function Documentation

◆ glfwDefaultWindowHints()

          void glfwDefaultWindowHints
          (
          void
          	)

This function resets all window hints to their default values.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window creation hints

glfwWindowHint

glfwWindowHintString

Since

Added in version 3.0.

◆ glfwWindowHint()

          void glfwWindowHint
          (
          int
          hint,

          int
          value

          )

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only integer value hints can be set with this function. String value hints are set with glfwWindowHintString.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters

[in]	hint	The window hint to set.

[in]	value	The new value of the window hint.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.

Thread safety

This function must only be called from the main thread.

See also

Window creation hints

glfwWindowHintString

glfwDefaultWindowHints

Since

Added in version 3.0. Replaces glfwOpenWindowHint.

◆ glfwWindowHintString()

          void glfwWindowHintString
          (
          int
          hint,

          const char *
          value

          )

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only string type hints can be set with this function. Integer value hints are set with glfwWindowHint.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters

[in]	hint	The window hint to set.

[in]	value	The new value of the window hint.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.

Pointer lifetime

The specified string is copied before this function returns.

Thread safety

This function must only be called from the main thread.

See also

Window creation hints

glfwWindowHint

glfwDefaultWindowHints

Since

Added in version 3.3.

◆ glfwCreateWindow()

          GLFWwindow* glfwCreateWindow
          (
          int
          width,

          int
          height,

          const char *
          title,

          GLFWmonitor *
          monitor,

          GLFWwindow *
          share

          )

This function creates a window and its associated OpenGL or OpenGL ES context. Most of the options controlling how the window and its context should be created are specified with window hints.

Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current. For information about the share parameter, see Context object sharing.

The created window, framebuffer and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To query the actual attributes of the created window, framebuffer and context, see glfwGetWindowAttrib, glfwGetWindowSize and glfwGetFramebufferSize.

To create a full screen window, you need to specify the monitor the window will cover. If no monitor is specified, the window will be windowed mode. Unless you have a way for the user to choose a specific monitor, it is recommended that you pick the primary monitor. For more information on how to query connected monitors, see Retrieving monitors.

For full screen windows, the specified size becomes the resolution of the window's desired video mode. As long as a full screen window is not iconified, the supported video mode most closely matching the desired video mode is set for the specified monitor. For more information about full screen windows, including the creation of so called windowed full screen or borderless full screen windows, see "Windowed full screen" windows.

Once you have created the window, you can switch it between windowed and full screen mode with glfwSetWindowMonitor. This will not affect its OpenGL or OpenGL ES context.

By default, newly created windows use the placement recommended by the window system. To create the window at a specific position, make it initially invisible using the GLFW_VISIBLE window hint, set its position and then show it.

As long as at least one full screen window is not iconified, the screensaver is prohibited from starting.

Window systems put limits on window sizes. Very large or very small window dimensions may be overridden by the window system on creation. Check the actual size after creation.

The swap interval is not set during window creation and the initial value may vary depending on driver settings and defaults.

Parameters

[in]	width	The desired width, in screen coordinates, of the window. This must be greater than zero.

[in]	height	The desired height, in screen coordinates, of the window. This must be greater than zero.

[in]	title	The initial, UTF-8 encoded window title.

[in]	monitor	The monitor to use for full screen mode, or NULL for windowed mode.

[in]	share	The window whose context to share resources with, or NULL to not share resources.

Returns

The handle of the created window, or NULL if an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE, GLFW_API_UNAVAILABLE, GLFW_VERSION_UNAVAILABLE, GLFW_FORMAT_UNAVAILABLE and GLFW_PLATFORM_ERROR.

Remarks

Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.

Windows: If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window. If no such icon is present, the IDI_APPLICATION icon will be used instead. To set a different icon, see glfwSetWindowIcon.

Windows: The context to share resources with must not be current on any other thread.

macOS: The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the GLFW_OPENGL_FORWARD_COMPAT and GLFW_OPENGL_PROFILE hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.

macOS: The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.

macOS: The first time a window is created the menu bar is created. If GLFW finds a MainMenu.nib it is loaded and assumed to contain a menu bar. Otherwise a minimal menu bar is created manually with common commands like Hide, Quit and About. The About entry opens a minimal about dialog with information from the application's bundle. Menu bar creation can be disabled entirely with the GLFW_COCOA_MENUBAR init hint.

macOS: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the GLFW_COCOA_RETINA_FRAMEBUFFER hint is GLFW_TRUE and the NSHighResolutionCapable key is enabled in the application bundle's Info.plist. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. The GLFW test and example programs use a custom Info.plist template for this, which can be found as CMake/MacOSXBundleInfo.plist.in in the source tree.

macOS: When activating frame autosaving with GLFW_COCOA_FRAME_NAME, the specified window size and position may be overridden by previously saved values.

X11: Some window managers will not respect the placement of initially hidden windows.

X11: Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state. This means you may not be able to query the final size, position or other attributes directly after window creation.

X11: The class part of the WM_CLASS window property will by default be set to the window title passed to this function. The instance part will use the contents of the RESOURCE_NAME environment variable, if present and not empty, or fall back to the window title. Set the GLFW_X11_CLASS_NAME and GLFW_X11_INSTANCE_NAME window hints to override this.

Wayland: Compositors should implement the xdg-decoration protocol for GLFW to decorate the window properly. If this protocol isn't supported, or if the compositor prefers client-side decorations, a very simple fallback frame will be drawn using the wp_viewporter protocol. A compositor can still emit close, maximize or fullscreen events, using for instance a keybind mechanism. If neither of these protocols is supported, the window won't be decorated.

Wayland: A full screen window will not attempt to change the mode, no matter what the requested size or refresh rate.

Wayland: Screensaver inhibition requires the idle-inhibit protocol to be implemented in the user's compositor.

Thread safety

This function must only be called from the main thread.

See also

Window creation

glfwDestroyWindow

Since

Added in version 3.0. Replaces glfwOpenWindow.

◆ glfwDestroyWindow()

          void glfwDestroyWindow
          (
          GLFWwindow *
          window	)

This function destroys the specified window and its context. On calling this function, no further callbacks will be called for that window.

If the context of the specified window is current on the main thread, it is detached before being destroyed.

Parameters

[in]	window	The window to destroy.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Note

The context of the specified window must not be current on any other thread when this function is called.

Reentrancy

This function must not be called from a callback.

Thread safety

This function must only be called from the main thread.

See also

Window creation

glfwCreateWindow

Since

Added in version 3.0. Replaces glfwCloseWindow.

◆ glfwWindowShouldClose()

          int glfwWindowShouldClose
          (
          GLFWwindow *
          window	)

This function returns the value of the close flag of the specified window.

Parameters

[in]	window	The window to query.

Returns

The value of the close flag.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function may be called from any thread. Access is not synchronized.

See also

Window closing and close flag

Since

Added in version 3.0.

◆ glfwSetWindowShouldClose()

          void glfwSetWindowShouldClose
          (
          GLFWwindow *
          window,

          int
          value

          )

This function sets the value of the close flag of the specified window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.

Parameters

[in]	window	The window whose flag to change.

[in]	value	The new value.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function may be called from any thread. Access is not synchronized.

See also

Window closing and close flag

Since

Added in version 3.0.

◆ glfwSetWindowTitle()

          void glfwSetWindowTitle
          (
          GLFWwindow *
          window,

          const char *
          title

          )

This function sets the window title, encoded as UTF-8, of the specified window.

Parameters

[in]	window	The window whose title to change.

[in]	title	The UTF-8 encoded window title.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

macOS: The window title will not be updated until the next time you process events.

Thread safety

This function must only be called from the main thread.

See also

Window title

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwSetWindowIcon()

          void glfwSetWindowIcon
          (
          GLFWwindow *
          window,

          int
          count,

          const GLFWimage *
          images

          )

This function sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

Parameters

[in]	window	The window whose icon to set.

[in]	count	The number of images in the specified array, or zero to revert to the default window icon.

[in]	images	The images to create the icon from. This is ignored if count is zero.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Pointer lifetime

The specified image data is copied before this function returns.

Remarks

macOS: The GLFW window has no icon, as it is not a document window, so this function does nothing. The dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.

Wayland: There is no existing protocol to change an icon, the window will thus inherit the one defined in the application's desktop file. This function always emits GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window icon

Since

Added in version 3.2.

◆ glfwGetWindowPos()

          void glfwGetWindowPos
          (
          GLFWwindow *
          window,

          int *
          xpos,

          int *
          ypos

          )

This function retrieves the position, in screen coordinates, of the upper-left corner of the content 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.

Parameters

[in]	window	The window to query.

[out]	xpos	Where to store the x-coordinate of the upper-left corner of the content area, or NULL.

[out]	ypos	Where to store the y-coordinate of the upper-left corner of the content area, or NULL.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

Wayland: There is no way for an application to retrieve the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window position

glfwSetWindowPos

Since

Added in version 3.0.

◆ glfwSetWindowPos()

          void glfwSetWindowPos
          (
          GLFWwindow *
          window,

          int
          xpos,

          int
          ypos

          )

This function sets the position, in screen coordinates, of the upper-left corner of the content 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.

Parameters

[in]	window	The window to query.

[in]	xpos	The x-coordinate of the upper-left corner of the content area.

[in]	ypos	The y-coordinate of the upper-left corner of the content area.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

Wayland: There is no way for an application to set the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window position

glfwGetWindowPos

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetWindowSize()

          void glfwGetWindowSize
          (
          GLFWwindow *
          window,

          int *
          width,

          int *
          height

          )

This function retrieves the size, in screen coordinates, of the content 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.

Parameters

[in]	window	The window whose size to retrieve.

[out]	width	Where to store the width, in screen coordinates, of the content area, or NULL.

[out]	height	Where to store the height, in screen coordinates, of the content area, or NULL.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window size

glfwSetWindowSize

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwSetWindowSizeLimits()

          void glfwSetWindowSizeLimits
          (
          GLFWwindow *
          window,

          int
          minwidth,

          int
          minheight,

          int
          maxwidth,

          int
          maxheight

          )

This function sets the size limits of the content area of the specified window. If the window is full screen, the size limits only take effect once it is made windowed. If the window is not resizable, this function does nothing.

The size limits are applied immediately to a windowed mode window and may cause it to be resized.

The maximum dimensions must be greater than or equal to the minimum dimensions and all must be greater than or equal to zero.

Parameters

[in]	window	The window to set limits for.

[in]	minwidth	The minimum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.

[in]	minheight	The minimum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.

[in]	maxwidth	The maximum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.

[in]	maxheight	The maximum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks

If you set size limits and an aspect ratio that conflict, the results are undefined.

Wayland: The size limits will not be applied until the window is actually resized, either by the user or by the compositor.

Thread safety

This function must only be called from the main thread.

See also

Window size limits

glfwSetWindowAspectRatio

Since

Added in version 3.2.

◆ glfwSetWindowAspectRatio()

          void glfwSetWindowAspectRatio
          (
          GLFWwindow *
          window,

          int
          numer,

          int
          denom

          )

This function sets the required aspect ratio of the content area of the specified window. If the window is full screen, the aspect ratio only takes effect once it is made windowed. If the window is not resizable, this function does nothing.

The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero. For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.

If the numerator and denominator is set to GLFW_DONT_CARE then the aspect ratio limit is disabled.

The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.

Parameters

[in]	window	The window to set limits for.

[in]	numer	The numerator of the desired aspect ratio, or GLFW_DONT_CARE.

[in]	denom	The denominator of the desired aspect ratio, or GLFW_DONT_CARE.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks

If you set size limits and an aspect ratio that conflict, the results are undefined.

Wayland: The aspect ratio will not be applied until the window is actually resized, either by the user or by the compositor.

Thread safety

This function must only be called from the main thread.

See also

Window size limits

glfwSetWindowSizeLimits

Since

Added in version 3.2.

◆ glfwSetWindowSize()

          void glfwSetWindowSize
          (
          GLFWwindow *
          window,

          int
          width,

          int
          height

          )

This function sets the size, in screen coordinates, of the content area of the specified window.

For full screen windows, this function updates the resolution of its desired video mode and switches to the video mode closest to it, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.

If you wish to update the refresh rate of the desired video mode in addition to its resolution, see glfwSetWindowMonitor.

The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.

Parameters

[in]	window	The window to resize.

[in]	width	The desired width, in screen coordinates, of the window content area.

[in]	height	The desired height, in screen coordinates, of the window content area.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

Wayland: A full screen window will not attempt to change the mode, no matter what the requested size.

Thread safety

This function must only be called from the main thread.

See also

Window size

glfwGetWindowSize

glfwSetWindowMonitor

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

◆ glfwGetFramebufferSize()

          void glfwGetFramebufferSize
          (
          GLFWwindow *
          window,

          int *
          width,

          int *
          height

          )

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.

Parameters

[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.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Framebuffer size

glfwSetFramebufferSizeCallback

Since

Added in version 3.0.

◆ glfwGetWindowFrameSize()

          void glfwGetWindowFrameSize
          (
          GLFWwindow *
          window,

          int *
          left,

          int *
          top,

          int *
          right,

          int *
          bottom

          )

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 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.

Parameters

[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.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window size

Since

Added in version 3.1.

◆ glfwGetWindowContentScale()

          void glfwGetWindowContentScale
          (
          GLFWwindow *
          window,

          float *
          xscale,

          float *
          yscale

          )

This function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

Parameters

[in]	window	The window to query.

[out]	xscale	Where to store the x-axis content scale, or NULL.

[out]	yscale	Where to store the y-axis content scale, or NULL.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window content scale

glfwSetWindowContentScaleCallback

glfwGetMonitorContentScale

Since

Added in version 3.3.

◆ glfwGetWindowOpacity()

          float glfwGetWindowOpacity
          (
          GLFWwindow *
          window	)

This function returns the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque. If the system does not support whole window transparency, this function always returns one.

The initial opacity value for newly created windows is one.

Parameters

[in]	window	The window to query.

Returns

The opacity value of the specified window.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window transparency

glfwSetWindowOpacity

Since

Added in version 3.3.

◆ glfwSetWindowOpacity()

          void glfwSetWindowOpacity
          (
          GLFWwindow *
          window,

          float
          opacity

          )

This function sets the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque.

The initial opacity value for newly created windows is one.

A window created with framebuffer transparency may not use whole window transparency. The results of doing this are undefined.

Parameters

[in]	window	The window to set the opacity for.

[in]	opacity	The desired opacity of the specified window.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window transparency

glfwGetWindowOpacity

Since

Added in version 3.3.

◆ glfwIconifyWindow()

          void glfwIconifyWindow
          (
          GLFWwindow *
          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.

Parameters

[in]	window	The window to iconify.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

Wayland: There is no concept of iconification in wl_shell, this function will emit GLFW_PLATFORM_ERROR when using this deprecated protocol.

Thread safety

This function must only be called from the main thread.

See also

Window iconification

glfwRestoreWindow

glfwMaximizeWindow

Since

Added in version 2.1. GLFW 3: Added window handle parameter.

◆ glfwRestoreWindow()

          void glfwRestoreWindow
          (
          GLFWwindow *
          window	)

This function restores the specified window if it was previously iconified (minimized) or maximized. 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.

Parameters

[in]	window	The window to restore.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window iconification

glfwIconifyWindow

glfwMaximizeWindow

Since

Added in version 2.1. GLFW 3: Added window handle parameter.

◆ glfwMaximizeWindow()

          void glfwMaximizeWindow
          (
          GLFWwindow *
          window	)

This function maximizes the specified window if it was previously not maximized. If the window is already maximized, this function does nothing.

If the specified window is a full screen window, this function does nothing.

Parameters

[in]	window	The window to maximize.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread Safety

This function may only be called from the main thread.

See also

Window iconification

glfwIconifyWindow

glfwRestoreWindow

Since

Added in GLFW 3.2.

◆ glfwShowWindow()

          void glfwShowWindow
          (
          GLFWwindow *
          window	)

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.

By default, windowed mode windows are focused when shown Set the GLFW_FOCUS_ON_SHOW window hint to change this behavior for all newly created windows, or change the behavior for an existing window with glfwSetWindowAttrib.

Parameters

[in]	window	The window to make visible.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window visibility

glfwHideWindow

Since

Added in version 3.0.

◆ glfwHideWindow()

          void glfwHideWindow
          (
          GLFWwindow *
          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.

Parameters

[in]	window	The window to hide.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window visibility

glfwShowWindow

Since

Added in version 3.0.

◆ glfwFocusWindow()

          void glfwFocusWindow
          (
          GLFWwindow *
          window	)

This function brings the specified window to front and sets input focus. The window should already be visible and not iconified.

By default, both windowed and full screen mode windows are focused when initially created. Set the GLFW_FOCUSED to disable this behavior.

Also by default, windowed mode windows are focused when shown with glfwShowWindow. Set the GLFW_FOCUS_ON_SHOW to disable this behavior.

Do not use this function to steal focus from other applications unless you are certain that is what the user wants. Focus stealing can be extremely disruptive.

For a less disruptive way of getting the user's attention, see attention requests.

Parameters

[in]	window	The window to give input focus.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

Wayland: It is not possible for an application to bring its windows to front, this function will always emit GLFW_PLATFORM_ERROR.

Thread safety

This function must only be called from the main thread.

See also

Window input focus

Window attention request

Since

Added in version 3.2.

◆ glfwRequestWindowAttention()

          void glfwRequestWindowAttention
          (
          GLFWwindow *
          window	)

This function requests user attention to the specified window. On platforms where this is not supported, attention is requested to the application as a whole.

Once the user has given attention, usually by focusing the window or application, the system will end the request automatically.

Parameters

[in]	window	The window to request attention to.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

macOS: Attention is requested to the application as a whole, not the specific window.

Thread safety

This function must only be called from the main thread.

See also

Window attention request

Since

Added in version 3.3.

◆ glfwGetWindowMonitor()

          GLFWmonitor* glfwGetWindowMonitor
          (
          GLFWwindow *
          window	)

This function returns the handle of the monitor that the specified window is in full screen on.

Parameters

[in]	window	The window to query.

Returns

The monitor, or NULL if the window is in windowed mode or an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window monitor

glfwSetWindowMonitor

Since

Added in version 3.0.

◆ glfwSetWindowMonitor()

          void glfwSetWindowMonitor
          (
          GLFWwindow *
          window,

          GLFWmonitor *
          monitor,

          int
          xpos,

          int
          ypos,

          int
          width,

          int
          height,

          int
          refreshRate

          )

This function sets the monitor that the window uses for full screen mode or, if the monitor is NULL, makes it windowed mode.

When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.

When the monitor is NULL, the position, width and height are used to place the window content area. The refresh rate is ignored when no monitor is specified.

If you only wish to update the resolution of a full screen window or the size of a windowed mode window, see glfwSetWindowSize.

When a window transitions from full screen to windowed mode, this function restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.

Parameters

[in]	window	The window whose monitor, size or video mode to set.

[in]	monitor	The desired monitor, or NULL to set windowed mode.

[in]	xpos	The desired x-coordinate of the upper-left corner of the content area.

[in]	ypos	The desired y-coordinate of the upper-left corner of the content area.

[in]	width	The desired with, in screen coordinates, of the content area or video mode.

[in]	height	The desired height, in screen coordinates, of the content area or video mode.

[in]	refreshRate	The desired refresh rate, in Hz, of the video mode, or GLFW_DONT_CARE.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks

The OpenGL or OpenGL ES context will not be destroyed or otherwise affected by any resizing or mode switching, although you may need to update your viewport if the framebuffer size has changed.

Wayland: The desired window position is ignored, as there is no way for an application to set this property.

Wayland: Setting the window to full screen will not attempt to change the mode, no matter what the requested size or refresh rate.

Thread safety

This function must only be called from the main thread.

See also

Window monitor

Full screen windows

glfwGetWindowMonitor

glfwSetWindowSize

Since

Added in version 3.2.

◆ glfwGetWindowAttrib()

          int glfwGetWindowAttrib
          (
          GLFWwindow *
          window,

          int
          attrib

          )

This function returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.

Parameters

[in]	window	The window to query.

[in]	attrib	The window attribute whose value to return.

Returns

The value of the attribute, or zero if an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.

Remarks

Framebuffer related hints are not window attributes. See Framebuffer related attributes for more information.

Zero is a valid value for many window and context related attributes so you cannot use a return value of zero as an indication of errors. However, this function should not fail as long as it is passed valid arguments and the library has been initialized.

Thread safety

This function must only be called from the main thread.

See also

Window attributes

glfwSetWindowAttrib

Since

Added in version 3.0. Replaces glfwGetWindowParam and glfwGetGLVersion.

◆ glfwSetWindowAttrib()

          void glfwSetWindowAttrib
          (
          GLFWwindow *
          window,

          int
          attrib,

          int
          value

          )

This function sets the value of an attribute of the specified window.

The supported attributes are GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW.

Some of these attributes are ignored for full screen windows. The new value will take effect if the window is later made windowed.

Some of these attributes are ignored for windowed mode windows. The new value will take effect if the window is later made full screen.

Parameters

[in]	window	The window to set the attribute for.

[in]	attrib	A supported window attribute.

[in]	value	GLFW_TRUE or GLFW_FALSE.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks

Calling glfwGetWindowAttrib will always return the latest value, even if that value is ignored by the current mode of the window.

Thread safety

This function must only be called from the main thread.

See also

Window attributes

glfwGetWindowAttrib

Since

Added in version 3.3.

◆ glfwSetWindowUserPointer()

          void glfwSetWindowUserPointer
          (
          GLFWwindow *
          window,

          void *
          pointer

          )

This function sets the user-defined pointer of the specified window. The current value is retained until the window is destroyed. The initial value is NULL.

Parameters

[in]	window	The window whose pointer to set.

[in]	pointer	The new value.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function may be called from any thread. Access is not synchronized.

See also

User pointer

glfwGetWindowUserPointer

Since

Added in version 3.0.

◆ glfwGetWindowUserPointer()

          void* glfwGetWindowUserPointer
          (
          GLFWwindow *
          window	)

This function returns the current value of the user-defined pointer of the specified window. The initial value is NULL.

Parameters

[in]	window	The window whose pointer to return.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function may be called from any thread. Access is not synchronized.

See also

User pointer

glfwSetWindowUserPointer

Since

Added in version 3.0.

◆ glfwSetWindowPosCallback()

          GLFWwindowposfun glfwSetWindowPosCallback
          (
          GLFWwindow *
          window,

          GLFWwindowposfun
          callback

          )

This function sets the position callback of the specified window, which is called when the window is moved. The callback is provided with the position, in screen coordinates, of the upper-left corner of the content area of the window.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int xpos, int ypos)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Remarks

Wayland: This callback will never be called, as there is no way for an application to know its global position.

Thread safety

This function must only be called from the main thread.

See also

Window position

Since

Added in version 3.0.

◆ glfwSetWindowSizeCallback()

          GLFWwindowsizefun glfwSetWindowSizeCallback
          (
          GLFWwindow *
          window,

          GLFWwindowsizefun
          callback

          )

This function sets the size callback of the specified window, which is called when the window is resized. The callback is provided with the size, in screen coordinates, of the content area of the window.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int width, int height)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window size

Since

Added in version 1.0. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowCloseCallback()

          GLFWwindowclosefun glfwSetWindowCloseCallback
          (
          GLFWwindow *
          window,

          GLFWwindowclosefun
          callback

          )

This function sets the close callback of the specified window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.

The close flag is set before this callback is called, but you can modify it at any time with glfwSetWindowShouldClose.

The close callback is not triggered by glfwDestroyWindow.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Remarks

macOS: Selecting Quit from the application menu will trigger the close callback for all windows.

Thread safety

This function must only be called from the main thread.

See also

Window closing and close flag

Since

Added in version 2.5. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowRefreshCallback()

          GLFWwindowrefreshfun glfwSetWindowRefreshCallback
          (
          GLFWwindow *
          window,

          GLFWwindowrefreshfun
          callback

          )

This function sets the refresh callback of the specified window, which is called when the content area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.

On compositing window systems such as Aero, Compiz, Aqua or Wayland, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window);

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window damage and refresh

Since

Added in version 2.5. GLFW 3: Added window handle parameter and return value.

◆ glfwSetWindowFocusCallback()

          GLFWwindowfocusfun glfwSetWindowFocusCallback
          (
          GLFWwindow *
          window,

          GLFWwindowfocusfun
          callback

          )

This function sets the focus callback of the specified window, which is called when the window gains or loses input focus.

After the focus callback is called for a window that lost input focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see glfwSetKeyCallback and glfwSetMouseButtonCallback.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int focused)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window input focus

Since

Added in version 3.0.

◆ glfwSetWindowIconifyCallback()

          GLFWwindowiconifyfun glfwSetWindowIconifyCallback
          (
          GLFWwindow *
          window,

          GLFWwindowiconifyfun
          callback

          )

This function sets the iconification callback of the specified window, which is called when the window is iconified or restored.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int iconified)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Remarks

Wayland: The wl_shell protocol has no concept of iconification, this callback will never be called when using this deprecated protocol.

Thread safety

This function must only be called from the main thread.

See also

Window iconification

Since

Added in version 3.0.

◆ glfwSetWindowMaximizeCallback()

          GLFWwindowmaximizefun glfwSetWindowMaximizeCallback
          (
          GLFWwindow *
          window,

          GLFWwindowmaximizefun
          callback

          )

This function sets the maximization callback of the specified window, which is called when the window is maximized or restored.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int maximized)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window maximization

Since

Added in version 3.3.

◆ glfwSetFramebufferSizeCallback()

          GLFWframebuffersizefun glfwSetFramebufferSizeCallback
          (
          GLFWwindow *
          window,

          GLFWframebuffersizefun
          callback

          )

This function sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, int width, int height)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Framebuffer size

Since

Added in version 3.0.

◆ glfwSetWindowContentScaleCallback()

          GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback
          (
          GLFWwindow *
          window,

          GLFWwindowcontentscalefun
          callback

          )

This function sets the window content scale callback of the specified window, which is called when the content scale of the specified window changes.

Parameters

[in]	window	The window whose callback to set.

[in]	callback	The new callback, or NULL to remove the currently set callback.

Returns

The previously set callback, or NULL if no callback was set or the library had not been initialized.

Callback signature

void function_name(GLFWwindow* window, float xscale, float yscale)

 For more information about the callback parameters, see the function pointer type.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function must only be called from the main thread.

See also

Window content scale

glfwGetWindowContentScale

Since

Added in version 3.3.

◆ glfwPollEvents()

          void glfwPollEvents
          (
          void
          	)

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 to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Reentrancy

This function must not be called from a callback.

Thread safety

This function must only be called from the main thread.

See also

Event processing

glfwWaitEvents

glfwWaitEventsTimeout

Since

Added in version 1.0.

◆ glfwWaitEvents()

          void glfwWaitEvents
          (
          void
          	)

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 to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Reentrancy

This function must not be called from a callback.

Thread safety

This function must only be called from the main thread.

See also

Event processing

glfwPollEvents

glfwWaitEventsTimeout

Since

Added in version 2.5.

◆ glfwWaitEventsTimeout()

          void glfwWaitEventsTimeout
          (
          double
          timeout	)

This function puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If 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.

The timeout value must be a positive finite number.

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 to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Parameters

[in]	timeout	The maximum amount of time, in seconds, to wait.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Reentrancy

This function must not be called from a callback.

Thread safety

This function must only be called from the main thread.

See also

Event processing

glfwPollEvents

glfwWaitEvents

Since

Added in version 3.2.

◆ glfwPostEmptyEvent()

          void glfwPostEmptyEvent
          (
          void
          	)

This function posts an empty event from the current thread to the event queue, causing glfwWaitEvents or glfwWaitEventsTimeout to return.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread safety

This function may be called from any thread.

See also

Event processing

glfwWaitEvents

glfwWaitEventsTimeout

Since

Added in version 3.1.

◆ glfwSwapBuffers()

          void glfwSwapBuffers
          (
          GLFWwindow *
          window	)

This function swaps the front and back buffers of the specified window when rendering with OpenGL or OpenGL ES. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.

The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a GLFW_NO_WINDOW_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see vkQueuePresentKHR instead.

Parameters

[in]	window	The window whose buffers to swap.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_WINDOW_CONTEXT and GLFW_PLATFORM_ERROR.

Remarks

EGL: The context of the specified window must be current on the calling thread.

Thread safety

This function may be called from any thread.

See also

Buffer swapping

glfwSwapInterval

Since

Added in version 1.0. GLFW 3: Added window handle parameter.

GLFWwindow

struct GLFWwindow GLFWwindow

Opaque window object.

Definition: glfw3.h:1152

<address class="footer">

Last update on Mon Jan 20 2020 for GLFW 3.3.2

</address>


text:
export const Conditions: {[k: string]: ModdedConditionData} = {
	brn: {
		name: 'brn',
		effectType: 'Status',
		onStart(target) {
			this.add('-status', target, 'brn');
		},
		onAfterMoveSelfPriority: 2,
		onAfterMoveSelf(pokemon) {
			this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
		},
		onAfterSwitchInSelf(pokemon) {
			this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
		},
	},
	par: {
		name: 'par',
		effectType: 'Status',
		onStart(target) {
			this.add('-status', target, 'par');
		},
		onBeforeMovePriority: 2,
		onBeforeMove(pokemon) {
			if (this.randomChance(63, 256)) {
				this.add('cant', pokemon, 'par');
				pokemon.removeVolatile('bide');
				pokemon.removeVolatile('lockedmovee');
				pokemon.removeVolatile('twoturnmove');
				pokemon.removeVolatile('fly');
				pokemon.removeVolatile('dig');
				pokemon.removeVolatile('solarbeam');
				pokemon.removeVolatile('skullbash');
				pokemon.removeVolatile('partialtrappinglock');
				return false;
			}
		},
	},
	slp: {
		name: 'slp',
		effectType: 'Status',
		onStart(target, source, sourceEffect) {
			if (sourceEffect && sourceEffect.effectType === 'Move') {
				this.add('-status', target, 'slp', '[from] move: ' + sourceEffect.name);
			} else {
				this.add('-status', target, 'slp');
			}
			// 1-3 turns
			this.effectState.startTime = this.random(1, 4);
			this.effectState.time = this.effectState.startTime;

			if (target.removeVolatile('nightmare')) {
				this.add('-end', target, 'Nightmare', '[silent]');
			}
		},
		onBeforeMovePriority: 2,
		onBeforeMove(pokemon, target, move) {
			pokemon.statusState.time--;
			this.add('cant', pokemon, 'slp');
			pokemon.lastMove = null;
			return false;
		},
		onAfterMoveSelf(pokemon) {
			if (pokemon.statusState.time <= 0) pokemon.cureStatus();
		},
	},
	frz: {
		name: 'frz',
		effectType: 'Status',
		onStart(target) {
			this.add('-status', target, 'frz');
		},
		onBeforeMovePriority: 2,
		onBeforeMove(pokemon, target, move) {
			this.add('cant', pokemon, 'frz');
			pokemon.lastMove = null;
			return false;
		},
		onHit(target, source, move) {
			if (move.type === 'Fire' && move.category !== 'Status') {
				target.cureStatus();
			}
		},
	},
	psn: {
		name: 'psn',
		effectType: 'Status',
		onStart(target) {
			this.add('-status', target, 'psn');
		},
		onAfterMoveSelfPriority: 2,
		onAfterMoveSelf(pokemon) {
			this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
		},
		onAfterSwitchInSelf(pokemon) {
			this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
		},
	},
	confusion: {
		inherit: true,
		onStart(target) {
			this.add('-start', target, 'confusion');
			this.effectState.time = this.random(2, 6);
		},
	},
	flinch: {
		inherit: true,
		onStart() {},
	},
	partiallytrapped: {
		name: 'partiallytrapped',
		duration: 2,
		onBeforeMovePriority: 1,
		onStart(target, source, effect) {
			this.add('-activate', target, 'move: ' + effect, '[of] ' + source);
		},
		onBeforeMove(pokemon) {
			if (this.effectState.source && (!this.effectState.source.isActive || this.effectState.source.hp <= 0)) {
				pokemon.removeVolatile('partiallytrapped');
				return;
			}
			this.add('cant', pokemon, 'partiallytrapped');
			return false;
		},
		onEnd(pokemon) {
			this.add('-end', pokemon, this.effectState.sourceEffect, '[partiallytrapped]');
		},
	},
};

redpajama_set_name: RedPajamaGithub


text: SELECT c2 FROM collate1t1 ORDER BY 1 COLLATE hex DESC;


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_servers"
        android:icon="@drawable/ic_action_servers"
        android:orderInCategory="99"
        android:showAsAction="ifRoom"
        android:title="@string/servers">
        <menu>
            <group android:checkableBehavior="single" android:visible="true" android:enabled="true" android:menuCategory="container" android:id="@+id/servers_group">

            </group>
        </menu>
    </item>

    <item
        android:id="@+id/menu_settings"
        android:icon="@android:drawable/ic_menu_preferences"
        android:orderInCategory="100"
        android:showAsAction="ifRoom"
        android:title="@string/settings"/>

    <item
        android:id="@+id/menu_help"
        android:icon="@android:drawable/ic_menu_help"
        android:orderInCategory="101"
        android:showAsAction="never"
        android:title="@string/help"/>

    <item
        android:id="@+id/menu_rescan_servers"
        android:icon="@android:drawable/ic_menu_search"
        android:orderInCategory="102"
        android:showAsAction="never"
        android:title="@string/rescan_servers"/>

    <item
        android:id="@+id/menu_exit_app"
        android:icon="@android:drawable/ic_menu_close_clear_cancel"
        android:orderInCategory="103"
        android:showAsAction="never"
        android:title="@string/exit_app"/>

</menu>


text:
Generates regular expressions that match a range.

Ever wanted to write a regex like this?

    prefix = /[612-793]/
    "650" =~ prefix # => true
    "794" =~ prefix # => false

Character classes don't work like that! But now you can:

    prefix = RangeRegexp.new(619..793).regexp
    "650" =~ prefix # => true
    "794" =~ prefix # => false

Happiness!

## Installation

Add this line to your application's Gemfile:

    gem 'range_regexp'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install range_regexp

## Usage

Pass a range to the constructor. Get it with #regexp.

    re = RangeRegexp.new(12..24).regexp
    re =~ "12" # => True

It works with strings if you're clever with your range:

    re = RangeRegexp.new("foobar".."foobaz").regexp
    re =~ "foobat" # => true

It knows how many characters it matches:

    RangeRegexp.new(135..643).size # => 3
    RangeRegexp.new(1..9).size # => 1
    RangeRegexp.new("foobar".."foobaz").size # => 6

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
MEDUSA_BEGIN;

class TableBoxItem
{
public:
	TableBoxItem();
	~TableBoxItem(void);
	bool operator<(const TableBoxItem& item)const { return Index < item.Index; }
	bool operator==(const TableBoxItem& item)const { return Index == item.Index; }

	int Compare(const TableBoxItem& item)const;
	void ArrangeNode(const Point2F& movement, NodeLayoutArrangeFlags arrangeFlags = NodeLayoutArrangeFlags::None);
	void ApplyMovement(const Point2F& movement);

	float Width()const { return BoundingBox.Width(); }
	float Height()const { return BoundingBox.Height(); }

	TableBox* Parent() const { return mParent; }
	void SetParent(TableBox* val) { mParent = val; }

	void Initialzie(TableBox* parent, uint index,const Size2F& itemFixedSize);

	uint Row()const;
	uint Column()const;

public:
	INode* Node = nullptr;
	size_t Index = 0;
	int Tag = 0;

	Rect2F BoundingBox;
private:
	Point2F mOffset{ 0.f,0.f };
	TableBox* mParent=nullptr;
};

MEDUSA_END;


text:
package io.quarkus.qute;

import java.util.concurrent.CompletionStage;

/**
 *
 * @see ReflectionValueResolver
 */
@FunctionalInterface
interface ValueAccessor {

    /**
     *
     * @param instance
     * @return the value
     */
    CompletionStage<Object> getValue(Object instance);

}


text:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SonosSharp.Eventing
{
    public class HttpServer : BasicHttpServer
    {
        private HttpListener _listener;
        public override string CallbackUrl
        {
            get { return "http://169.254.80.80:8889/"; }
        }

        protected override async System.Threading.Tasks.Task StartInternalAsync()
        {
            await Task.Run(() =>
                {
                    _listener = new HttpListener();
                    _listener.Prefixes.Add(CallbackUrl);
                    _listener.Start();
                    ThreadPool.QueueUserWorkItem(state =>
                        {
                            while (true)
                            {
                                var context = _listener.GetContext();
                                StringBuilder fullRequest = new StringBuilder();

                                foreach (string header in context.Request.Headers)
                                {
                                    fullRequest.AppendLine(String.Format("{0}: {1}", header, context.Request.Headers[header]));
                                }

                                fullRequest.AppendLine();

                                using (var reader = new StreamReader(context.Request.InputStream))
                                {
                                    fullRequest.Append(reader.ReadToEnd());
                                }

                                bool result = base.ProcessHttpRequest(fullRequest.ToString());

                                context.Response.StatusCode = result ? 200 : 500;

                                context.Response.Close();

                            }
                        });
                });
        }

        protected override async System.Threading.Tasks.Task StopInternalAsync()
        {
        }
    }
}


text:
typedef HMODULE LibHandle;
#define GET_CONTEXT_PROC_ADDRESS(f, type, name) (f) = reinterpret_cast<type>(ogl_utils::GET_PROC_ADDRESS_FUNC(name));
#else
typedef void* LibHandle;
#ifdef GLES
#define GET_CONTEXT_PROC_ADDRESS(f, type, name) (f) = reinterpret_cast<type>(ogl_utils::GET_PROC_ADDRESS_FUNC((const char*)name));
#else
#define GET_CONTEXT_PROC_ADDRESS(f, type, name) (f) = reinterpret_cast<type>(ogl_utils::GET_PROC_ADDRESS_FUNC((const GLubyte*)name));
#endif
#endif

#define LOAD_LIBRARY_SYMBOL(varName, type)                                                \
    if (nullptr == (varName))                                                             \
    {                                                                                \
        (varName) = reinterpret_cast<decltype(type)*>(LOAD_SYMBOL(gl_lib_handle, #type)); \
    }

// Declarations for GLX_MESA_query_renderer extension (subset -- just what is needed for GPA GL).
#ifndef GLX_MESA_query_renderer
#define GLX_MESA_query_renderer 1           /// Constant used to query the renderer using the MESA extension.
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184  /// Constant used to query the device id using the MESA extension.
#endif

#ifdef GLES
// GL_EXT_disjoint_timer_query.
#define PFNGLGENQUERIESPROC PFNGLGENQUERIESEXTPROC
#define PFNGLDELETEQUERIESPROC PFNGLDELETEQUERIESEXTPROC
#define PFNGLGETQUERYOBJECTIVPROC PFNGLGETQUERYOBJECTIVEXTPROC
#define PFNGLQUERYCOUNTERPROC PFNGLQUERYCOUNTEREXTPROC
#endif

namespace ogl_utils
{
    extern decltype(GET_PROC_ADDRESS_TYPE)* GET_PROC_ADDRESS_FUNC;

    // Timer query GL extensions.
    extern PFNGLGENQUERIESPROC       ogl_gen_queries;
    extern PFNGLDELETEQUERIESPROC    ogl_delete_queries;
    extern PFNGLGETQUERYOBJECTIVPROC ogl_get_query_objective_iv;
    extern PFNGLQUERYCOUNTERPROC     ogl_query_counter;

    extern decltype(glFlush)*       ogl_flush;
    extern decltype(glGetString)*   ogl_get_string;
    extern decltype(glGetIntegerv)* ogl_get_integer_v;
    extern decltype(glGetError)*    ogl_get_error;
    extern PFNGLGETSTRINGIPROC      ogl_get_string_i;

    extern PFNGLGETQUERYOBJECTUI64VEXTPROC ogl_get_query_object_ui_64_v_ext;  // Exists in GL and GLES as extension.

    /// AMD perf monitor extensions.
    extern PFNGLGETPERFMONITORGROUPSAMDPROC        ogl_get_perf_monitor_groups_amd;
    extern PFNGLGETPERFMONITORCOUNTERSAMDPROC      ogl_get_perf_monitor_counters_amd;
    extern PFNGLGETPERFMONITORGROUPSTRINGAMDPROC   ogl_get_perf_monitor_group_string_amd;
    extern PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC ogl_get_perf_monitor_counter_string_amd;
    extern PFNGLGETPERFMONITORCOUNTERINFOAMDPROC   ogl_get_perf_monitor_counter_info_amd;
    extern PFNGLGENPERFMONITORSAMDPROC             ogl_gen_perf_monitors_amd;
    extern PFNGLDELETEPERFMONITORSAMDPROC          ogl_delete_perf_monitors_amd;
    extern PFNGLSELECTPERFMONITORCOUNTERSAMDPROC   ogl_select_perf_monitor_counters_amd;
    extern PFNGLBEGINPERFMONITORAMDPROC            ogl_begin_perf_monitor_amd;
    extern PFNGLENDPERFMONITORAMDPROC              ogl_end_perf_monitor_amd;
    extern PFNGLGETPERFMONITORCOUNTERDATAAMDPROC   ogl_get_perf_monitor_counter_data_amd;

#ifdef DEBUG_GL_ERRORS
    extern PFN_OGL_GLDEBUGMESSAGECONTROLARB  ogl_debug_message_control_arb;
    extern PFN_OGL_GLDEBUGMESSAGEINSERTARB   ogl_debug_message_insert_arb;
    extern PFN_OGL_GLDEBUGMESSAGECALLBACKARB ogl_debug_message_callback_arb;
    extern PFN_OGL_GLGETDEBUGMESSAGELOGARB   ogl_get_debug_message_log_arb;
#endif

    extern PFN_GLX_QUERYCURRENTRENDERERINTEGERMESA ogl_x_query_current_renderer_integer_mesa;  ///< Function pointer for glxQueryCurrentRendererIntegerMesa.
    extern PFN_GL_SETGPADEVICECLOCKMODEAMDX        ogl_set_gpa_device_clock_mode_amd_x;        ///< Function pointer for glSetGpaDeviceClockModeAMDX.

    /// @brief Loads the OpenGL library.
    ///
    /// @return True if loaded successfully otherwise false.
    bool LoadGl();

    /// @brief Queries OpenGL extensions and initializes the entry points needed for perf counter collection.
    ///
    /// The extensions queried are:
    ///    -- GL_AMD_performance_monitor
    ///    -- GL_ARB_timer_query (OpenGL)
    ///    -- GL_EXT_disjoint_timer_query (OpenGLES)
    ///    -- GL_AMD_debug_output
    ///    -- GLX_MESA_query_renderer
    ///
    /// @retval false If the GL_AMD_performance_monitor or GL_ARB_timer_query extension entry points are not found.
    /// @retval true Otherwise.
    bool InitializeGlFunctions();

    /// @brief Query supported extensions.
    void QuerySupportedExtensions();

    /// @brief Initializes the GL core functions.
    ///
    /// @return True upon success otherwise false.
    bool InitializeGlCoreFunctions();

    /// @brief Initializes the OpenGL AMD perf extension function to use with current rendering context.
    ///
    /// @return True upon successful otherwise false.
    bool InitCtxAmdPerfExtFunctions();

    extern const char* kAmdRendererString;            ///< AMD Renderer string.
    extern const char* kRadeonRendererString;         ///< Radeon Renderer string.
    extern const char* kAtiRendererString;            ///< ATI Renderer string (legacy).
    extern const char* kNvidiaRendererString;         ///< NVIDIA Renderer string.
    extern const char* kIntelRendererString;          ///< Intel Renderer string.
    extern bool        are_gl_functions_initialized;  ///< Flag indicating if the GL extensions and functions have been initialized.
    extern LibHandle   gl_lib_handle;                 ///< Handle to the GL lib.

    using GLExtension = std::string;                            ///< Alias for GL extension.
    using Supported   = bool;                                   ///< Alias for extension status.
    extern std::map<GLExtension, Supported> gl_extensions_map;  ///< Map of GL extensions and its status.
}

#endif  // GPA_COUNTER_GENERATOR_GL_GL_ENTRY_POINTS_H_


text:
/*
NOT NEEDED ANYMORE, JUST FOR REFERENCE
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace UnityPlatformer {
  [CustomEditor(typeof(MovingPlatform))]
  class MovingPlatformEditor : Editor {
    void OnSceneGUI() {
      // Do your drawing here using Handles.
      //Handles.BeginGUI();

      MovingPlatform mp = target as MovingPlatform;

      if (mp.localWaypoints != null) {
        Handles.color = Color.red;
        float size = .3f;

        Vector3[] list = new Vector3[mp.localWaypoints.Length * 2];

        for (int i = 0; i < mp.localWaypoints.Length; ++i) {
          Vector3 globalWaypointPos = (Application.isPlaying) ? mp.globalWaypoints[i] : mp.localWaypoints[i] + mp.transform.position;
          if (i != mp.localWaypoints.Length - 1) {
            list[i*2] = globalWaypointPos;
            list[i*2+1] = (Application.isPlaying) ? mp.globalWaypoints[i + 1] : mp.localWaypoints[i + 1] + mp.transform.position;
          }
          Handles.DrawLine(globalWaypointPos - Vector3.up * size, globalWaypointPos + Vector3.up * size);
          Handles.DrawLine(globalWaypointPos - Vector3.left * size, globalWaypointPos + Vector3.left * size);
          Handles.Label(globalWaypointPos + new Vector3(-0.1f, 0.8f, 0), "" + i);;
        }

        Handles.DrawLines(list);
      }
      // Do your drawing here using GUI.
      //Handles.EndGUI();
    }
  }
}
*/


text:
FOUNDATION_EXPORT double Pods_StoryboardDemoVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_StoryboardDemoVersionString[];


text:
package main.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import main.bean.PersonBean;
import main.fragment.selectperson.ListDepartmentFragment;
import main.fragment.selectperson.ListPersonFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;

import com.example.aqscgkpt.R;

public class SelectPersonActivity extends SimpleFragmentActivity implements
		ListDepartmentFragment.Callbacks, ListPersonFragment.CallBacks {

	private HashMap<String, boolean[]> mSelectStatus = new HashMap<String, boolean[]>();
	private String parentID;
	private ArrayList<PersonBean> selectedList = new ArrayList<PersonBean>();

	@Override
	protected void onCreate(Bundle arg0) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(arg0);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		mSelectStatus = null;
		selectedList = null;
		parentID = null;
	}

	@Override
	protected int getLayoutResId() {
		return R.layout.fragment_select_person;
	}

	@Override
	protected Fragment[] createFragment() {
		Fragment[] ft = new Fragment[2];
		ft[0] = new ListDepartmentFragment();
		ft[1] = ListPersonFragment.newInstance("", "", null,"",0);
		return ft;
	}

	@Override
	protected int[] getAllFragmentId() {
		int[] id = new int[2];
		id[0] = R.id.department_fragment_container;
		id[1] = R.id.person_fragment_container;
		return id;
	}

	@Override
	public void onDepartSelect(String parentID, String name) {
		this.parentID = parentID;
		FragmentManager fm = getFragmentManager();
		FragmentTransaction ft = fm.beginTransaction();

		Fragment oldF = fm.findFragmentById(R.id.person_fragment_container);
		boolean[] isSelect = null;
		if (mSelectStatus.containsKey(parentID)) {
			isSelect = mSelectStatus.get(parentID);
		}
		Fragment newF = ListPersonFragment
				.newInstance(parentID, name, isSelect,getSelectedName(selectedList),selectedList.size());
		if (oldF != null) {
			ft.remove(oldF);
		}
		ft.add(R.id.person_fragment_container, newF);
		ft.commit();
	}

	@Override
	public void onPersonSelected(int pos, boolean isSelected, int size,
			PersonBean pb) {
		Log.i("fanjishuo_____onPersonSelected", "isSelected" + isSelected
				+ "pos" + pos);
		boolean[] isSelect;
		if (!mSelectStatus.containsKey(parentID)) {
			isSelect = new boolean[size];
		} else {
			isSelect = mSelectStatus.get(parentID);
		}
		if (isSelected) {
			Log.i("fanjishuo_____onPersonSelected", "add" + pb.getName());
			selectedList.add(pb);
		} else {
			Iterator<PersonBean> it = selectedList.iterator();
			while (it.hasNext()) {
				PersonBean temp = it.next();
				if (temp.getPersonID() == pb.getPersonID())
					it.remove();
			}
		}
		FragmentManager fm = getFragmentManager();
		ListPersonFragment oldF = (ListPersonFragment) fm
				.findFragmentById(R.id.person_fragment_container);
		oldF.setNameTextView(selectedList);
		isSelect[pos] = isSelected;
		mSelectStatus.put(parentID, isSelect);
	}
	private String getSelectedName(ArrayList<PersonBean> selectPerson){
		StringBuilder sb = new StringBuilder();
		for (PersonBean pb : selectPerson) {
			sb.append(pb.getName() + "、");
		}
		return sb.toString();
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>com.cypaubr.jmath.geometry.trigonometry</title>
<meta name="date" content="2017-01-12">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

com.cypaubr.jmath.geometry.trigonometry

Classes

Triangle


text:
function JuegoLaberinto(){
	this.nombre="JuegoLaberinto";
}