Class: GLFW::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/glfw/stubs/window.rb,
lib/glfw/constants.rb

Overview

Represents an application window and OpenGL context.

Cursor Mode collapse

CURSOR_NORMAL =

The cursor is visible and behaves normally.

0x00034001
CURSOR_HIDDEN =

The cursor is invisible when it is over the content area of the window but does not restrict the cursor from leaving.

0x00034002
CURSOR_DISABLED =

The application window hides and grabs the cursor, providing virtual and unlimited cursor movement, useful for implementing 3D camera controls.

0x00034003

Instance Attribute Summary collapse

Callback Functions collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height, title = nil, **opts) ⇒ Window

Note:

The OpenGL coontext will automatically be made current on the thread for the new window.

Creates a new instance of the GLFW::Window class.

Parameters:

  • width (Integer)

    The desired width of the window, in screen coordinates.

  • height (Integer)

    The desired height of the window, in screen coordinates.

  • title (String?) (defaults to: nil)

    The caption to display in the system menubar, window titlebar, etc.

  • opts (Hash)

    The options hash.

Options Hash (**opts):

  • :center (Boolean) — default: true

    true to have window initially centered on screen.

  • :vsync (Boolean) — default: true

    true to enable vertical syncronization with the monitor refresh.

  • :monitor (Monitor) — default: nil

    Specifies a monitor to create the window on.

  • :shared (Window) — default: nil

    Specified another window instance to share context resources with.

  • :full_window (Boolean) — default: false

    Initializes window as "borderless fullscreen", which allows faster context switching.

  • :fullscreen (Boolean) — default: false

    Initializes window as fullscreen.



47
48
# File 'lib/glfw/stubs/window.rb', line 47

def initialize(width, height, title = nil, **opts)
end

Instance Attribute Details

#auto_focusBoolean

Returns a value indicating if window will automatically focus when being restored from minimized state, etc.

Returns:

  • (Boolean)

    a value indicating if window will automatically focus when being restored from minimized state, etc.



338
339
340
# File 'lib/glfw/stubs/window.rb', line 338

def auto_focus
  @auto_focus
end

#clipboardString?

Returns a string for the clipboard associated with the window.

Returns:

  • (String?)

    a string for the clipboard associated with the window.



334
335
336
# File 'lib/glfw/stubs/window.rb', line 334

def clipboard
  @clipboard
end

#content_scaleVec2 (readonly)

Returns the current content scale of the window.

Returns:

  • (Vec2)

    the current content scale of the window.



376
377
378
# File 'lib/glfw/stubs/window.rb', line 376

def content_scale
  @content_scale
end

#cursorCursor?

Returns the mouse cursor the window uses, or nil if not specified.

Returns:

  • (Cursor?)

    the mouse cursor the window uses, or nil if not specified.



314
315
316
# File 'lib/glfw/stubs/window.rb', line 314

def cursor
  @cursor
end

#cursor_modeInteger

Returns a value indicating the behavior of the mouse cursor.

Returns:

  • (Integer)

    a value indicating the behavior of the mouse cursor.

See Also:



345
346
347
# File 'lib/glfw/stubs/window.rb', line 345

def cursor_mode
  @cursor_mode
end

#cursor_posVec2

Returns the location of the mouse cursor.

Returns:

  • (Vec2)

    the location of the mouse cursor.



318
319
320
# File 'lib/glfw/stubs/window.rb', line 318

def cursor_pos
  @cursor_pos
end

#decoratedBoolean

Returns a value indicating if the window will be decoarted with a frame, close widget, etc.

Returns:

  • (Boolean)

    a value indicating if the window will be decoarted with a frame, close widget, etc.



326
327
328
# File 'lib/glfw/stubs/window.rb', line 326

def decorated
  @decorated
end

#framebuffer_sizeSize (readonly)

Returns the dimensions of the window's primary framebuffer, in pixel coordinates.

Returns:

  • (Size)

    the dimensions of the window's primary framebuffer, in pixel coordinates.



380
381
382
# File 'lib/glfw/stubs/window.rb', line 380

def framebuffer_size
  @framebuffer_size
end

#iconImage+

The icon(s) to be displayed as a window decoration, on systems that support this functionality.

Returns:

  • (Image, Array<Image>)

    an image or array of possible images.



302
303
304
# File 'lib/glfw/stubs/window.rb', line 302

def icon
  @icon
end

#lock_modifiersBoolean

Returns a value indicating if modifier bits for input callback functions will include MOD_CAPS_LOCK, MOD_NUM_LOCK, etc.

Returns:

  • (Boolean)

    a value indicating if modifier bits for input callback functions will include MOD_CAPS_LOCK, MOD_NUM_LOCK, etc.



357
358
359
# File 'lib/glfw/stubs/window.rb', line 357

def lock_modifiers
  @lock_modifiers
end

#monitorMonitor? (readonly)

Returns the monitor the window is displayed on, or nil if not a fullscreen window.

Returns:

  • (Monitor?)

    the monitor the window is displayed on, or nil if not a fullscreen window.



372
373
374
# File 'lib/glfw/stubs/window.rb', line 372

def monitor
  @monitor
end

#opacityFloat

Returns a value determining the visibility of the window (including frame), where 0.0 is invisible and 1.0 is fully opaque.

Returns:

  • (Float)

    a value determining the visibility of the window (including frame), where 0.0 is invisible and 1.0 is fully opaque.



322
323
324
# File 'lib/glfw/stubs/window.rb', line 322

def opacity
  @opacity
end

#positionPoint

Returns the position of the top-left corner of the window's client area, in screen coordinates.

Returns:

  • (Point)

    the position of the top-left corner of the window's client area, in screen coordinates.



306
307
308
# File 'lib/glfw/stubs/window.rb', line 306

def position
  @position
end

#raw_mouse_motionBoolean

When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can be enabled if available.

Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled.

Returns:

  • (Boolean)

    true if raw mouse motion is enabled, otherwise false.



368
369
370
# File 'lib/glfw/stubs/window.rb', line 368

def raw_mouse_motion
  @raw_mouse_motion
end

#resizableBoolean

Returns a value indicating if window is resizable by the user.

Returns:

  • (Boolean)

    a value indicating if window is resizable by the user.



330
331
332
# File 'lib/glfw/stubs/window.rb', line 330

def resizable
  @resizable
end

#sizeSize

Returns the size of the window's client area, in screen coordinates.

Returns:

  • (Size)

    the size of the window's client area, in screen coordinates.



310
311
312
# File 'lib/glfw/stubs/window.rb', line 310

def size
  @size
end

#sticky_buttonsBoolean

Returns a value indicating if input states for mouse buttons will persist until queried with #button?.

Returns:

  • (Boolean)

    a value indicating if input states for mouse buttons will persist until queried with #button?.



353
354
355
# File 'lib/glfw/stubs/window.rb', line 353

def sticky_buttons
  @sticky_buttons
end

#sticky_keysBoolean

Returns a value indicating if input states for keys will persist until queried with #key?.

Returns:

  • (Boolean)

    a value indicating if input states for keys will persist until queried with #key?.



349
350
351
# File 'lib/glfw/stubs/window.rb', line 349

def sticky_keys
  @sticky_keys
end

#titleString?

Returns the window caption displayed in the system menubar, window titlebar, etc.

Returns:

  • (String?)

    the window caption displayed in the system menubar, window titlebar, etc.



289
290
291
# File 'lib/glfw/stubs/window.rb', line 289

def title
  @title
end

#topmostBoolean

Returns true if window is floating (always-on-top) of other application windows, otherwise false.

Returns:

  • (Boolean)

    true if window is floating (always-on-top) of other application windows, otherwise false.



297
298
299
# File 'lib/glfw/stubs/window.rb', line 297

def topmost
  @topmost
end

#visibleBoolean

Returns the visibility state of the window.

Returns:

  • (Boolean)

    the visibility state of the window.



293
294
295
# File 'lib/glfw/stubs/window.rb', line 293

def visible
  @visible
end

Class Method Details

.currentWindow?

Returns the GLFW::Window whose context is current on the calling thread, or nil if none is found.

Returns:

  • (Window?)

    the GLFW::Window whose context is current on the calling thread, or nil if none is found.



28
29
# File 'lib/glfw/stubs/window.rb', line 28

def self.current
end

.default_hintsvoid

This method returns an undefined value.

Resets all window hints that have been applied back to the "default" configuration.



11
12
# File 'lib/glfw/stubs/window.rb', line 11

def self.default_hints
end

.hint(hint, value) ⇒ void

This method returns an undefined value.

Sets a hint for the next window creation. Once set, the value will persist until changed with this function or the library is terminated.

Parameters:

  • hint (Integer)

    A value indicating the hint to change. See the GLFW constants prefixed with HINT for valid values for this parameter.

  • value (Integer, Boolean, String)

    The desired value to set for this hint.



23
24
# File 'lib/glfw/stubs/window.rb', line 23

def self.hint(hint, value)
end

Instance Method Details

#aspect_ratio(numerator, denominator) ⇒ void

This method returns an undefined value.

Modifies the behavior when a user resizes the window to stay locked to the specified aspect ratio.

Parameters:

  • numerator (Integer)

    The numerator component of the aspect ratio.

  • denominator (Integer)

    The denominator component of the aspect ratio.



109
110
# File 'lib/glfw/stubs/window.rb', line 109

def aspect_ratio(numerator, denominator)
end

#button?(button) ⇒ Boolean

Returns the last state reported for the specified mouse button to the window.

Parameters:

  • key (Integer)

    The mouse button to query.

Returns:

  • (Boolean)

    true if mouse button is depressed, otherwise false.

See Also:



260
261
# File 'lib/glfw/stubs/window.rb', line 260

def button?(button)
end

#centerself

Centers a window on the screen. Has no effect on fullscreen windows.

Returns:

  • (self)


146
147
# File 'lib/glfw/stubs/window.rb', line 146

def center
end

#change_monitor(monitor, position, size, hz = -1)) ⇒ void

This method returns an undefined value.

Ssets the monitor that the window uses for full screen mode or, if the monitor is nil, 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 nil, the position, width and height are used to place the window content area. The refresh rate is ignored when no monitor is specified.

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:

  • monitor (Monitor?)

    The desired monitor, or nil to set windowed mode.

  • position (Point)

    The desired location of the upper-left corner of the content area.

  • size (Size)

    The desired size in screen coordinates of the content area or video mode.

  • hz (Integer) (defaults to: -1))

    The desired refresh rate, in Hz, of the video mode, or -1 to ignore.



284
285
# File 'lib/glfw/stubs/window.rb', line 284

def change_monitor(monitor, position, size, hz = -1)
end

#close(flag = true) ⇒ self

Sets the closing state of the window.

Parameters:

  • flag (Boolean) (defaults to: true)

    true to set window state to close, otherwise false to cancel a close action that is in progress.

Returns:

  • (self)

See Also:



158
159
# File 'lib/glfw/stubs/window.rb', line 158

def close(flag = true)
end

#closing?Boolean

Retrieves value indicating if window is currently set to close.

return [Boolean] true if window is set to close, otherwise false.

Returns:

  • (Boolean)

See Also:



168
169
# File 'lib/glfw/stubs/window.rb', line 168

def closing?
end

#current?Boolean

Returns value indicating if the OpenGL context of this window is current on the calling thread.

Returns:

  • (Boolean)

    true if context is current, otherwise false.

See Also:



69
70
# File 'lib/glfw/stubs/window.rb', line 69

def current?
end

#destroyvoid Also known as: dispose

This method returns an undefined value.

Destroys the window, reclaiming any resources it is using and invalidating it for further use.



53
54
# File 'lib/glfw/stubs/window.rb', line 53

def destroy
end

#focusself

Brings the specified window to front and sets input focus. The window should already be visible and not minimized.

Returns:

  • (self)


200
201
# File 'lib/glfw/stubs/window.rb', line 200

def focus
end

#focused?Boolean

Returns value indicating if the window currently contains the operating system input focus.

Returns:

  • (Boolean)

    true if window has input focus, otherwise false.



75
76
# File 'lib/glfw/stubs/window.rb', line 75

def focused?
end

#frame_sizeArray<Integer>

Note:

Values will always be greater than or equal to 0.

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.

Returns:

  • (Array<Integer>)

    a 4-element array in the order of left, top, right, bottom, where each value is the size, in screen coordinates, of the window's frame.



130
131
# File 'lib/glfw/stubs/window.rb', line 130

def frame_size
end

#fullscreen?Boolean

Returns value indicating if window is currently in fullscreen mode on the monitor.

Returns:

  • (Boolean)

    true if window is fullscreen, otherwise false.



99
100
# File 'lib/glfw/stubs/window.rb', line 99

def fullscreen?
end

#hideself

Hides the window if it was previously visible. If the window is already hidden or is in full screen mode, this method does nothing.

Returns:

  • (self)

See Also:



194
195
# File 'lib/glfw/stubs/window.rb', line 194

def hide
end

#hovered?Boolean

Returns value indicating if the mouse cursor is currently over thw window's client area.

Returns:

  • (Boolean)

    true if cursor is over the window, otherwise false.



93
94
# File 'lib/glfw/stubs/window.rb', line 93

def hovered?
end

#key?(key) ⇒ Boolean

Returns the last state reported for the specified key to the window.

Parameters:

  • key (Integer)

    The key to query.

Returns:

  • (Boolean)

    true if key is depressed, otherwise false.

See Also:



249
250
# File 'lib/glfw/stubs/window.rb', line 249

def key?(key)
end

#make_currentself

Sets the OpenGL context of the window as current on the calling thread.

Returns:

  • (self)

See Also:



62
63
# File 'lib/glfw/stubs/window.rb', line 62

def make_current
end

#maximizeself

Maximizes the window if it was previously not maximized. If the window is already maximized, this function does nothing. If the window is fullscreen, this function does nothing.

Returns:

  • (self)

See Also:



220
221
# File 'lib/glfw/stubs/window.rb', line 220

def maximize
end

#maximized?Boolean

Returns value indicated if window is currently maximized to fill the work area of the monitor.

Returns:

  • (Boolean)

    true if window is maximized, otherwise false.



87
88
# File 'lib/glfw/stubs/window.rb', line 87

def maximized?
end

#minimizeself

Mminimizes the window if it was previously restored. If the window is already iconified, this function does nothing. If the window is fullscreen, the original monitor resolution is restored until the window is restored.

Returns:

  • (self)

See Also:



210
211
# File 'lib/glfw/stubs/window.rb', line 210

def minimize
end

#minimized?Boolean

Returns value indicating if window is currently minimized to the system toolbar.

Returns:

  • (Boolean)

    true if window is minimized, otherwsie false.



81
82
# File 'lib/glfw/stubs/window.rb', line 81

def minimized?
end

#move_cursor(x, y) ⇒ void

This method returns an undefined value.

Moves the mouse cursor to the specified coordinates.

Parameters:

  • x (Float)

    The location to move the cursor to on the x-axis in screen coordinates, relative to the window's client area.

  • y (Float)

    The location to move the cursor to on the y-axis in screen coordinates, relative to the window's client area.



140
141
# File 'lib/glfw/stubs/window.rb', line 140

def move_cursor(x, y)
end

#on_char {|codepoint| ... } ⇒ Proc? #on_charProc?

The character callback is intended for Unicode text input. As it deals with characters, it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.

The character callback behaves as system text input normally does and will not be called if modifier keys are held down that would prevent normal text input on that platform, for example a Super (Command) key on macOS or Alt key on Windows.

Overloads:

  • #on_char {|codepoint| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when a Unicode character is input.

    Yield Parameters:

    • codepoint (Integer)

      A Unicode codepoint.

  • #on_charProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.



609
610
# File 'lib/glfw/stubs/window.rb', line 609

def on_char
end

#on_close { ... } ⇒ Proc? #on_closeProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_close { ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window is flagged to close.

    Yields:

    • No arguments are yielded to the block.

  • #on_closeProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



467
468
# File 'lib/glfw/stubs/window.rb', line 467

def on_close
end

#on_cursor_enter {|entered| ... } ⇒ Proc? #on_cursor_enterProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_cursor_enter {|entered| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the mouse cursor enters or leaves the content area of the window.

    Yield Parameters:

    • entered (Booleab)

      true if cursor is entering the window, otherwise false when leaving.

  • #on_cursor_enterProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.



588
589
# File 'lib/glfw/stubs/window.rb', line 588

def on_cursor_enter
end

#on_cursor_move {|x, y| ... } ⇒ Proc? #on_cursor_moveProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_cursor_move {|x, y| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the mouse cursor moves.

    Yield Parameters:

    • x (Float)

      The new cursor position on the x-axis, in screen coordinates and relative to the top-left corner of the window's client area.

    • y (Float)

      The new cursor position on the y-axis, in screen coordinates and relative to the top-left corner of the window's client area.

  • #on_cursor_moveProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



525
526
# File 'lib/glfw/stubs/window.rb', line 525

def on_cursor_move
end

#on_file_drop {|paths| ... } ⇒ Proc? #on_file_dropProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_file_drop {|paths| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when a files/folders are drag-dropped onto the windows client area.

    Yield Parameters:

    • paths (Array<String>)

      An array of the absolite paths of the filepaths that were dropped.

  • #on_file_dropProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.



508
509
# File 'lib/glfw/stubs/window.rb', line 508

def on_file_drop
end

#on_focus {|focused| ... } ⇒ Proc? #on_focusProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_focus {|focused| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window gains or loses input focus.

    Yield Parameters:

    • focused (Boolean)

      true if window has gained focus, otherwise false if it was lost.

  • #on_focusProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



437
438
# File 'lib/glfw/stubs/window.rb', line 437

def on_focus
end

#on_framebuffer_resize {|width, height| ... } ⇒ Proc? #on_framebuffer_resizeProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_framebuffer_resize {|width, height| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window's framebuffer size changes.

    Yield Parameters:

    • width (Integer)

      The new width of the framebuffer, in pixel units.

    • height (Integer)

      The new height of the framebuffer, in pixel units.

  • #on_framebuffer_resizeProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



395
396
# File 'lib/glfw/stubs/window.rb', line 395

def on_framebuffer_resize
end

#on_key {|key, scancode, action, modifiers| ... } ⇒ Proc? #on_keyProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_key {|key, scancode, action, modifiers| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when a key state changes.

    Yield Parameters:

    • key (Integer)

      The keyboard key that was pressed or released.

    • scancode (Integer)

      The system-specific scancode of the key.

    • action (Integer)

      A value indicating the state of the key

    • modifiers (Integer)

      A bitfield value of modifier keys that were present during the action.

  • #on_keyProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



557
558
# File 'lib/glfw/stubs/window.rb', line 557

def on_key
end

#on_maximize {|maximized| ... } ⇒ Proc? #on_maximizeProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_maximize {|maximized| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window maximized or restored.

    Yield Parameters:

    • maximized (Boolean)

      true if window has been maximized, otherwise false if being restored.

  • #on_maximizeProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



495
496
# File 'lib/glfw/stubs/window.rb', line 495

def on_maximize
end

#on_minimize {|minimized| ... } ⇒ Proc? #on_minimizeProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_minimize {|minimized| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window minimized or restored.

    Yield Parameters:

    • minimized (Boolean)

      true if window has been minimized, otherwise false if being restored.

  • #on_minimizeProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



481
482
# File 'lib/glfw/stubs/window.rb', line 481

def on_minimize
end

#on_mouse_button {|button, action, modifiers| ... } ⇒ Proc? #on_mouse_buttonProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_mouse_button {|button, action, modifiers| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when a mouse button state changes.

    Yield Parameters:

    • button (Integer)

      The mouse button that was pressed or released.

    • action (Integer)

      A value indicating the state of the button.

    • modifiers (Integer)

      A bitfield value of modifier keys that were present during the action.

  • #on_mouse_buttonProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



575
576
# File 'lib/glfw/stubs/window.rb', line 575

def on_mouse_button
end

#on_move {|x, y| ... } ⇒ Proc? #on_moveProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_move {|x, y| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window's position is changed.

    Yield Parameters:

    • x (Integer)

      The new position of the window on the x-axis, in screen coordinates.

    • y (Integer)

      The new position of the window on the y-axis, in screen coordinates.

  • #on_moveProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



423
424
# File 'lib/glfw/stubs/window.rb', line 423

def on_move
end

#on_refresh { ... } ⇒ Proc? #on_refreshProc?

Note:

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.

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_refresh { ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked 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.

    Yields:

    • No arguments are yielded to the block.

  • #on_refreshProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.



453
454
# File 'lib/glfw/stubs/window.rb', line 453

def on_refresh
end

#on_resize {|width, height| ... } ⇒ Proc? #on_resizeProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_resize {|width, height| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window size changes.

    Yield Parameters:

    • width (Integer)

      The new width of the window's client area, in screen coordinates.

    • height (Integer)

      The new height of the window's client area, in screen coordinates.

  • #on_resizeProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



409
410
# File 'lib/glfw/stubs/window.rb', line 409

def on_resize
end

#on_scale {|x, y| ... } ⇒ Proc? #on_scaleProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_scale {|x, y| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the window's content scale is changed.

    Yield Parameters:

    • x (Float)

      The new content scaling factor on the x-axis.

    • y (Float)

      The new content scaling factor on the y-axis.

  • #on_scaleProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.

See Also:



623
624
# File 'lib/glfw/stubs/window.rb', line 623

def on_scale
end

#on_scroll {|x, y| ... } ⇒ Proc? #on_scrollProc?

Returns the previous callback that was set, or nil if none existed.

Overloads:

  • #on_scroll {|x, y| ... } ⇒ Proc?

    When called with a block, sets a callback to be invoked when the mouse wheel is scrolled.

    Yield Parameters:

    • x (Float)

      The scroll amount on the x-axis, or 0.0 when not supported.

    • y (Float)

      The scroll amount on the y-axis.

  • #on_scrollProc?

    When called without a block, clears any callback that is set.

Returns:

  • (Proc?)

    the previous callback that was set, or nil if none existed.



538
539
# File 'lib/glfw/stubs/window.rb', line 538

def on_scroll
end

#request_attentionself

Requests user attention to the 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.

Returns:

  • (self)


238
239
# File 'lib/glfw/stubs/window.rb', line 238

def request_attention
end

#restoreself

Restores the window if it was previously minimized or maximized. If the window is already restored, this function does nothing. If the window is fullscreen, the resolution chosen for the window is restored on the selected monitor.

Returns:

  • (self)

See Also:



230
231
# File 'lib/glfw/stubs/window.rb', line 230

def restore
end

#showself

Makes the window visible if it was previously hidden. If the window is already visible or is in full screen mode, this method does nothing.

Returns:

  • (self)

See Also:



185
186
# File 'lib/glfw/stubs/window.rb', line 185

def show
end

#size_limits(min, max) ⇒ void

This method returns an undefined value.

Sets the minimum and maximum sizes that a user can resize the window to.

Parameters:

  • min (Size)

    The minimum size of the window's client area the user can resize to, in screen coordinates.

  • max (Size)

    The maximum size of the window's client area the user can resize to, in screen coordinates.



119
120
# File 'lib/glfw/stubs/window.rb', line 119

def size_limits(min, max)
end

#swap_buffersvoid

This method returns an undefined value.

Typically called each frame, swaps the front and back buffers used for rendering, presenting the current back buffer to the user, while staging the current front buffer to be overwritten.



176
177
# File 'lib/glfw/stubs/window.rb', line 176

def swap_buffers
end