glfw 1.0.3 → 3.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +161 -0
- data/.yardopts +6 -0
- data/Gemfile +2 -4
- data/README.md +29 -33
- data/Rakefile +6 -4
- data/ext/glfw/common.c +159 -0
- data/ext/glfw/cursor.c +34 -30
- data/ext/glfw/extconf.rb +7 -17
- data/ext/glfw/glfw.c +122 -377
- data/ext/glfw/glfw.h +46 -41
- data/ext/glfw/image.c +96 -64
- data/ext/glfw/joystick.c +169 -0
- data/ext/glfw/monitor.c +231 -155
- data/ext/glfw/stb_image.h +7656 -0
- data/ext/glfw/window.c +708 -576
- data/glfw.gemspec +10 -9
- data/lib/glfw.rb +4 -14
- data/lib/glfw/constants.rb +365 -0
- data/lib/glfw/stubs.rb +234 -0
- data/lib/glfw/stubs/cursor.rb +21 -0
- data/lib/glfw/stubs/gamepad_state.rb +30 -0
- data/lib/glfw/stubs/image.rb +39 -0
- data/lib/glfw/stubs/joystick.rb +125 -0
- data/lib/glfw/stubs/monitor.rb +115 -0
- data/lib/glfw/stubs/video_mode.rb +32 -0
- data/lib/glfw/stubs/window.rb +626 -0
- data/lib/glfw/version.rb +8 -1
- metadata +31 -35
- data/.travis.yml +0 -5
- data/Makefile +0 -267
- data/ext/glfw/common.h +0 -46
- data/ext/glfw/cursor.h +0 -14
- data/ext/glfw/glfw3.h +0 -4248
- data/ext/glfw/glfw3native.h +0 -456
- data/ext/glfw/image.h +0 -14
- data/ext/glfw/ming32/WINDOWS USERS PLACE libglf3.a HERE.txt b/data/ext/glfw/ming32/WINDOWS USERS PLACE libglf3.a → HERE.txt +0 -0
- data/ext/glfw/ming64/WINDOWS USERS PLACE libglf3.a HERE.txt b/data/ext/glfw/ming64/WINDOWS USERS PLACE libglf3.a → HERE.txt +0 -0
- data/ext/glfw/monitor.h +0 -29
- data/ext/glfw/video_mode.c +0 -60
- data/ext/glfw/video_mode.h +0 -21
- data/ext/glfw/vulkan.c +0 -48
- data/ext/glfw/vulkan.h +0 -16
- data/ext/glfw/window.h +0 -87
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Describes the application's mouse cursor object and how it appears for the window.
|
6
|
+
class Cursor
|
7
|
+
|
8
|
+
##
|
9
|
+
# @overload initialize(shape)
|
10
|
+
# Creates a new cursor using a standard shape defined by the operating system.
|
11
|
+
# @param shape [Integer] An integer representing the shape of the cursor to create.
|
12
|
+
#
|
13
|
+
# @overload initialize(image, xhot = 0, yhot = 0)
|
14
|
+
# Creates a new cursor using the specified image.
|
15
|
+
# @param image [Image] A source image to use for the cursor's appearance.
|
16
|
+
# @param xhot [Integer] The "hot-point" of the cursor on the x-axis, where 0 is the left edge of the image.
|
17
|
+
# @param yhot [Integer] The "hot-point" of the cursor on the y-axis, where 0 is the top edge of the image.
|
18
|
+
def initialize(*argv)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Describes the captured state of a gamepad.
|
6
|
+
class GamepadState
|
7
|
+
|
8
|
+
##
|
9
|
+
# Queries the value of the axis at the specified index.
|
10
|
+
#
|
11
|
+
# @param index [Integer] The desired index of the axis to query.
|
12
|
+
#
|
13
|
+
# @return [Float] The current axis value, or `0.0` if out of range.
|
14
|
+
# @note It is recommended to use the return value rounded to a specific precision, or "dead zone", as many devices
|
15
|
+
# will report miniscule values even when stationary.
|
16
|
+
# @note Use the class constants prefixed with `AXIS` for strongly typed index values if desired.
|
17
|
+
def axis(index)
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Queries the button state at the specified index.
|
22
|
+
#
|
23
|
+
# @param index [Integer] The desired index of the button to query.
|
24
|
+
#
|
25
|
+
# @return [Float] `true` if button is depressed, otherwise `false` if no input is detected or if index is out of range.
|
26
|
+
# @note Use the class constants prefixed with `BUTTON` for strongly typed index values if desired.
|
27
|
+
def button(index)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Object describing a raw image with uncompressed pixel data, with 32-bytes per pixel in RGBA byte order.
|
6
|
+
#
|
7
|
+
# This class may also be used for creating textures with OpenGL, simply use `GL_RGBA` as the pixel format
|
8
|
+
# and pass the value of the {pixels} method.
|
9
|
+
class Image
|
10
|
+
|
11
|
+
##
|
12
|
+
# @return [Integer] the width of the image, in pixel units.
|
13
|
+
attr_reader :width
|
14
|
+
|
15
|
+
##
|
16
|
+
# @return [Integer] the height of the image, in pixel units.
|
17
|
+
attr_reader :height
|
18
|
+
|
19
|
+
##
|
20
|
+
# @overload initialize(width, height, pixels = nil)
|
21
|
+
#
|
22
|
+
# @overload initialize(filename)
|
23
|
+
#
|
24
|
+
def initialize(width, height, pixels)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Gets the pixel data as a binary blob.
|
29
|
+
#
|
30
|
+
# @return [String] the pixel data.
|
31
|
+
def pixels
|
32
|
+
end
|
33
|
+
|
34
|
+
alias_method :columns, :width
|
35
|
+
alias_method :rows, :height
|
36
|
+
alias_method :to_blob, :pixels
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Provides methods for interacting and querying joystick and gamepad peripherals.
|
6
|
+
module Joystick
|
7
|
+
|
8
|
+
##
|
9
|
+
# Retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
|
10
|
+
#
|
11
|
+
# @param jid [Integer] The joystick index to query.
|
12
|
+
#
|
13
|
+
# @return [GamepadState?] the gamepad input state of the joystick or `nil` if an error occurred.
|
14
|
+
def self.gamepad_state(jid)
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Returns the name, encoded as UTF-8, of the specified joystick.
|
19
|
+
#
|
20
|
+
# @param jid [Integer] The joystick index to query.
|
21
|
+
#
|
22
|
+
# @return [String?] the UTF-8 encoded name of the gamepad, or `nil` if the joystick is not present, does not
|
23
|
+
# have a mapping or an error occurred.
|
24
|
+
def self.name(jid)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Returns the human-readable name of the gamepad from the gamepad mapping assigned to the specified joystick.
|
29
|
+
#
|
30
|
+
# @param jid [Integer] The joystick index to query.
|
31
|
+
#
|
32
|
+
# @return [String?] the UTF-8 encoded name of the gamepad, or `nil` if the joystick is not present, does not
|
33
|
+
# have a mapping or an error occurred.
|
34
|
+
def self.gamepad_name(jid)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Returns whether the specified joystick is present.
|
39
|
+
#
|
40
|
+
# @param jid [Integer] The joystick index to query.
|
41
|
+
# @return [Boolean] `true` if joystick is detected, otherwise `false`.
|
42
|
+
# @note There is no need to call this function before other functions that accept a joystick ID, as they all check
|
43
|
+
# for presence before performing any other work.
|
44
|
+
def self.present?(jid)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Returns whether the specified joystick is both present and has a gamepad mapping.
|
49
|
+
#
|
50
|
+
# @param jid [Integer] The joystick index to query.
|
51
|
+
#
|
52
|
+
# @return [Boolean] `true` if joystick is detected and it has gamepad mappings, otherwise `false`
|
53
|
+
def self.gamepad?(jid)
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# Returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified joystick
|
58
|
+
# The GUID is what connects a joystick to a gamepad mapping. A connected joystick will always have a
|
59
|
+
# GUID even if there is no gamepad mapping assigned to it.
|
60
|
+
#
|
61
|
+
# @param jid [Integer] The joystick index to query.
|
62
|
+
#
|
63
|
+
# @return [String?] The UTF-8 encoded GUID of the joystick, or `nil` if the joystick is not present or an error occurred.
|
64
|
+
def self.guid(jid)
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Returns the state of all buttons of the specified joystick.
|
69
|
+
#
|
70
|
+
# @param jid [Integer] The joystick index to query.
|
71
|
+
#
|
72
|
+
# @return [Array<Boolean>] an array where each element represents the joystick button at the same index, whose value
|
73
|
+
# if either `true` (pressed) or `false` (released).
|
74
|
+
def self.buttons(jid)
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Returns the values of all axes of the specified joystick. Each element in the array is a value between
|
79
|
+
# `-1.0` and `1.0`.
|
80
|
+
#
|
81
|
+
# @param jid [Integer] The joystick index to query.
|
82
|
+
#
|
83
|
+
# @return [Array<Float>] an array where each element represents the joystick axis at the same index
|
84
|
+
def self.axes(jid)
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# Returns the state of all hats of the specified joystick.
|
89
|
+
#
|
90
|
+
# @param jid [Integer] The joystick index to query.
|
91
|
+
#
|
92
|
+
# @return [Array<Boolean>] an array where each element represents the joystick hats at the same index, whose value
|
93
|
+
# if either `true` (pressed) or `false` (released).
|
94
|
+
def self.hats(jid)
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Parses the specified ASCII encoded string(s) and updates the internal list with any gamepad mappings it finds.
|
99
|
+
# This string may contain either a single gamepad mapping or many mappings separated by newlines.
|
100
|
+
#
|
101
|
+
# If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the one
|
102
|
+
# passed to this function. If the library is terminated and re-initialized the internal list will revert to the
|
103
|
+
# built-in default.
|
104
|
+
#
|
105
|
+
# @note The parser supports standard SDL gamepad mappings.
|
106
|
+
#
|
107
|
+
# @param mapping [String,Array<String>] One or more mappings to update.
|
108
|
+
#
|
109
|
+
# @return [Integer] the number of mappings that were updated.
|
110
|
+
def self.update_mappings(*mapping)
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# @overload self.on_connection(&block)
|
115
|
+
# When called with a block, sets a callback to be invoked when the connection state of a joystick is changed.
|
116
|
+
# @yieldparam connected [Boolean] `true` if device was connected, otherwise `false` if disconectted.
|
117
|
+
#
|
118
|
+
# @overload self.on_connection
|
119
|
+
# When called without a block, clears any callback that is set.
|
120
|
+
#
|
121
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
122
|
+
def self.on_connection
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Represents a handle to a physical monitor.
|
6
|
+
class Monitor
|
7
|
+
|
8
|
+
##
|
9
|
+
# Retrieves an array of all connected monitors.
|
10
|
+
# @return [Array<Monitor>] an array of monitors.
|
11
|
+
# @see primary
|
12
|
+
def self.available
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# @return [Monitor] the primary or "default" monitor.
|
17
|
+
# @see available
|
18
|
+
def self.primary
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @overload self.on_connection(&block)
|
23
|
+
# When called with a block, sets a callback to be invoked when the connection
|
24
|
+
# state of a monitor is changed.
|
25
|
+
# @yieldparam connected [Boolean] `true` if device was connected, otherwise `false` if disconectted.
|
26
|
+
#
|
27
|
+
# @overload self.on_connection
|
28
|
+
# When called without a block, clears any callback that is set.
|
29
|
+
#
|
30
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
31
|
+
def self.on_connection
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Generates an appropriately sized gamma ramp from the specified exponent and
|
36
|
+
# then sets the {gamma_ramp} with it. The value must be a finite number greater
|
37
|
+
# than zero.
|
38
|
+
#
|
39
|
+
# The software controlled gamma ramp is applied in addition to the hardware gamma
|
40
|
+
# correction, which today is usually an approximation of sRGB gamma. This means
|
41
|
+
# that setting a perfectly linear ramp, or gamma 1.0, will produce the default
|
42
|
+
# (usually sRGB-like) behavior.
|
43
|
+
#
|
44
|
+
# @param [Float] the desired exponent value, must be greater than `0.0` and finite.
|
45
|
+
#
|
46
|
+
# @return [void]
|
47
|
+
def gamma(exponent)
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Sets teh gamma ramp of the monitor. The ramp is an array of 3 equally sized
|
52
|
+
# arrays of integers that range from `0` to `65535`. Each child array represents
|
53
|
+
# the ramp for a single color component, in RGB order.
|
54
|
+
#
|
55
|
+
# @note It is strongly recommended to use {gamma} instead of this method.
|
56
|
+
# @note On Windows, the maximum size of a gamma ramp is 256.
|
57
|
+
#
|
58
|
+
# @return [Array<Array<Integer>, Array<Integer> Array<Integer>>] the gamma ramp.
|
59
|
+
attr_accessor :gamma_ramp
|
60
|
+
|
61
|
+
##
|
62
|
+
# The human-readable name of the specified monitor. The name typically reflects
|
63
|
+
# the make and model of the monitor and is not guaranteed to be unique among the
|
64
|
+
# connected monitors.
|
65
|
+
# @return [String] the monitor name.
|
66
|
+
attr_reader :name
|
67
|
+
|
68
|
+
##
|
69
|
+
# @return [Size] the physical dimensions of the monitor, in millimeter units.
|
70
|
+
attr_reader :physical_size
|
71
|
+
|
72
|
+
##
|
73
|
+
# @return [Size] the dimensions of the monitor, in screen coordinates.
|
74
|
+
attr_reader :size
|
75
|
+
|
76
|
+
##
|
77
|
+
# The position, in screen coordinates, of the upper-left corner of the work area.
|
78
|
+
# The work area is defined as the area of the monitor not occluded by the operating
|
79
|
+
# system task bar where present. If no task bar exists then the work area is the
|
80
|
+
# monitor resolution in screen coordinates.
|
81
|
+
# @return [Point] the location of the monitor's work area.
|
82
|
+
attr_reader :client_position
|
83
|
+
|
84
|
+
##
|
85
|
+
# The size of the "non-system" area of the monitor, in screen coordinates.
|
86
|
+
# The work area is defined as the area of the monitor not occluded by the operating
|
87
|
+
# system task bar where present. If no task bar exists then the work area is the
|
88
|
+
# monitor resolution in screen coordinates.
|
89
|
+
# @return [Size] the size of the monitor's work area.
|
90
|
+
attr_reader :client_size
|
91
|
+
|
92
|
+
##
|
93
|
+
# @return [VideoMode] the current video mode for the monitor.
|
94
|
+
attr_reader :video_mode
|
95
|
+
|
96
|
+
##
|
97
|
+
# @return [Array<VideoMode>] an array of all video modes available to the monitor.
|
98
|
+
attr_reader :video_modes
|
99
|
+
|
100
|
+
##
|
101
|
+
# etrieves the content scale for the specified monitor. The content scale is the ratio
|
102
|
+
# between the current DPI and the platform's default DPI. This is especially important
|
103
|
+
# for text and any UI elements. If the pixel dimensions of your UI scaled by this look
|
104
|
+
# appropriate on your machine then it should appear at a reasonable size on other machines
|
105
|
+
# regardless of their DPI and scaling settings. This relies on the system DPI and scaling
|
106
|
+
# settings being somewhat correct.
|
107
|
+
#
|
108
|
+
# The content scale may depend on both the monitor resolution and pixel density and on user
|
109
|
+
# settings. It may be very different from the raw DPI calculated from the physical size and
|
110
|
+
# current resolution.
|
111
|
+
#
|
112
|
+
# @return [Vec2] the current content scale of the monitor.
|
113
|
+
attr_reader :content_scale
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Describes the video settings for a {Monitor}.
|
6
|
+
class VideoMode
|
7
|
+
|
8
|
+
##
|
9
|
+
# @return [Integer] the width, in screen coordinates, of the video mode.
|
10
|
+
attr_reader :width
|
11
|
+
|
12
|
+
##
|
13
|
+
# @return [Integer] the height, in screen coordinates, of the video mode.
|
14
|
+
attr_reader :height
|
15
|
+
|
16
|
+
##
|
17
|
+
# @return [Integer] the bit depth of the red channel of the video mode.
|
18
|
+
attr_reader :red_bits
|
19
|
+
|
20
|
+
##
|
21
|
+
# @return [Integer] the bit depth of the green channel of the video mode.
|
22
|
+
attr_reader :green_bits
|
23
|
+
|
24
|
+
##
|
25
|
+
# @return [Integer] the bit depth of the blue channel of the video mode.
|
26
|
+
attr_reader :blue_bits
|
27
|
+
|
28
|
+
##
|
29
|
+
# @return [Integer] the refresh rate, in Hz, of the video mode.
|
30
|
+
attr_reader :refresh_rate
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,626 @@
|
|
1
|
+
|
2
|
+
module GLFW
|
3
|
+
|
4
|
+
##
|
5
|
+
# Represents an application window and OpenGL context.
|
6
|
+
class Window
|
7
|
+
|
8
|
+
##
|
9
|
+
# Resets all window hints that have been applied back to the "default" configuration.
|
10
|
+
# @return [void]
|
11
|
+
def self.default_hints
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Sets a hint for the next window creation. Once set, the value will persist until changed with this function
|
16
|
+
# or the library is terminated.
|
17
|
+
#
|
18
|
+
# @param hint [Integer] A value indicating the hint to change. See the GLFW constants prefixed with `HINT`
|
19
|
+
# for valid values for this parameter.
|
20
|
+
# @param value [Integer,Boolean,String] The desired value to set for this hint.
|
21
|
+
#
|
22
|
+
# @return [void]
|
23
|
+
def self.hint(hint, value)
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @return [Window?] the {Window} whose context is current on the calling thread, or `nil` if none is found.
|
28
|
+
def self.current
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Creates a new instance of the {Window} class.
|
33
|
+
#
|
34
|
+
# @param width [Integer] The desired width of the window, in screen coordinates.
|
35
|
+
# @param height [Integer] The desired height of the window, in screen coordinates.
|
36
|
+
# @param title [String?] The caption to display in the system menubar, window titlebar, etc.
|
37
|
+
# @param opts [Hash] The options hash.
|
38
|
+
#
|
39
|
+
# @option opts [Boolean] :center (true) `true` to have window initially centered on screen.
|
40
|
+
# @option opts [Boolean] :vsync (true) `true` to enable vertical syncronization with the monitor refresh.
|
41
|
+
# @option opts [Monitor] :monitor (nil) Specifies a monitor to create the window on.
|
42
|
+
# @option opts [Window] :shared (nil) Specified another window instance to share context resources with.
|
43
|
+
# @option opts [Boolean] :full_window (false) Initializes window as "borderless fullscreen", which allows faster context switching.
|
44
|
+
# @option opts [Boolean] :fullscreen (false) Initializes window as fullscreen.
|
45
|
+
#
|
46
|
+
# @note The OpenGL coontext will automatically be made current on the thread for the new window.
|
47
|
+
def initialize(width, height, title = nil, **opts)
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Destroys the window, reclaiming any resources it is using and invalidating it for further use.
|
52
|
+
# @return [void]
|
53
|
+
def destroy
|
54
|
+
end
|
55
|
+
|
56
|
+
alias_method :dispose, :destroy
|
57
|
+
|
58
|
+
##
|
59
|
+
# Sets the OpenGL context of the window as current on the calling thread.
|
60
|
+
# @return [self]
|
61
|
+
# @see current?
|
62
|
+
def make_current
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Returns value indicating if the OpenGL context of this window is current on the calling thread.
|
67
|
+
# @return [Boolean] `true` if context is current, otherwise `false`.
|
68
|
+
# @see make_current
|
69
|
+
def current?
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# Returns value indicating if the window currently contains the operating system input focus.
|
74
|
+
# @return [Boolean] `true` if window has input focus, otherwise `false`.
|
75
|
+
def focused?
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Returns value indicating if window is currently minimized to the system toolbar.
|
80
|
+
# @return [Boolean] `true` if window is minimized, otherwsie `false`.
|
81
|
+
def minimized?
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Returns value indicated if window is currently maximized to fill the work area of the monitor.
|
86
|
+
# @return [Boolean] `true` if window is maximized, otherwise `false`.
|
87
|
+
def maximized?
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# Returns value indicating if the mouse cursor is currently over thw window's client area.
|
92
|
+
# @return [Boolean] `true` if cursor is over the window, otherwise `false`.
|
93
|
+
def hovered?
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Returns value indicating if window is currently in fullscreen mode on the monitor.
|
98
|
+
# @return [Boolean] `true` if window is fullscreen, otherwise `false`.
|
99
|
+
def fullscreen?
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Modifies the behavior when a user resizes the window to stay locked to the specified aspect ratio.
|
104
|
+
#
|
105
|
+
# @param numerator [Integer] The numerator component of the aspect ratio.
|
106
|
+
# @param denominator [Integer] The denominator component of the aspect ratio.
|
107
|
+
#
|
108
|
+
# @return [void]
|
109
|
+
def aspect_ratio(numerator, denominator)
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Sets the minimum and maximum sizes that a user can resize the window to.
|
114
|
+
#
|
115
|
+
# @param min [Size] The minimum size of the window's client area the user can resize to, in screen coordinates.
|
116
|
+
# @param max [Size] The maximum size of the window's client area the user can resize to, in screen coordinates.
|
117
|
+
#
|
118
|
+
# @return [void]
|
119
|
+
def size_limits(min, max)
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar,
|
124
|
+
# if the window has one.
|
125
|
+
#
|
126
|
+
# @return [Array<Integer>] a 4-element array in the order of left, top, right, bottom, where each value is the size, in
|
127
|
+
# screen coordinates, of the window's frame.
|
128
|
+
#
|
129
|
+
# @note Values will always be greater than or equal to `0`.
|
130
|
+
def frame_size
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# Moves the mouse cursor to the specified coordinates.
|
135
|
+
#
|
136
|
+
# @param x [Float] The location to move the cursor to on the x-axis in screen coordinates, relative to the window's client area.
|
137
|
+
# @param y [Float] The location to move the cursor to on the y-axis in screen coordinates, relative to the window's client area.
|
138
|
+
#
|
139
|
+
# @return [void]
|
140
|
+
def move_cursor(x, y)
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Centers a window on the screen. Has no effect on fullscreen windows.
|
145
|
+
# @return [self]
|
146
|
+
def center
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Sets the closing state of the window.
|
151
|
+
#
|
152
|
+
# @param flag [Boolean] `true` to set window state to close, otherwise `false` to cancel a close action that is in progress.
|
153
|
+
#
|
154
|
+
# @return [self]
|
155
|
+
#
|
156
|
+
# @see closing?
|
157
|
+
# @see on_close
|
158
|
+
def close(flag = true)
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Retrieves value indicating if window is currently set to close.
|
163
|
+
#
|
164
|
+
# return [Boolean] `true` if window is set to close, otherwise `false`.
|
165
|
+
#
|
166
|
+
# @see close
|
167
|
+
# @see on_close
|
168
|
+
def closing?
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Typically called each frame, swaps the front and back buffers used for rendering, presenting the current back buffer to the
|
173
|
+
# user, while staging the current front buffer to be overwritten.
|
174
|
+
#
|
175
|
+
# @return [void]
|
176
|
+
def swap_buffers
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Makes the window visible if it was previously hidden.
|
181
|
+
# If the window is already visible or is in full screen mode, this method does nothing.
|
182
|
+
#
|
183
|
+
# @return [self]
|
184
|
+
# @see hide
|
185
|
+
def show
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# Hides the window if it was previously visible.
|
190
|
+
# If the window is already hidden or is in full screen mode, this method does nothing.
|
191
|
+
#
|
192
|
+
# @return [self]
|
193
|
+
# @see show
|
194
|
+
def hide
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Brings the specified window to front and sets input focus. The window should already be visible and not minimized.
|
199
|
+
# @return [self]
|
200
|
+
def focus
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Mminimizes the window if it was previously restored. If the window is already iconified, this function does nothing.
|
205
|
+
# If the window is fullscreen, the original monitor resolution is restored until the window is restored.
|
206
|
+
#
|
207
|
+
# @return [self]
|
208
|
+
# @see maximize
|
209
|
+
# @see restore
|
210
|
+
def minimize
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Maximizes the window if it was previously not maximized. If the window is already maximized, this function does nothing.
|
215
|
+
# If the window is fullscreen, this function does nothing.
|
216
|
+
#
|
217
|
+
# @return [self]
|
218
|
+
# @see minimize
|
219
|
+
# @see restore
|
220
|
+
def maximize
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Restores the window if it was previously minimized or maximized. If the window is already restored, this function does nothing.
|
225
|
+
# If the window is fullscreen, the resolution chosen for the window is restored on the selected monitor.
|
226
|
+
#
|
227
|
+
# @return [self]
|
228
|
+
# @see minimize
|
229
|
+
# @see maximize
|
230
|
+
def restore
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# Requests user attention to the window. On platforms where this is not supported, attention is requested to the application as a whole.
|
235
|
+
# Once the user has given attention, usually by focusing the window or application, the system will end the request automatically.
|
236
|
+
#
|
237
|
+
# @return [self]
|
238
|
+
def request_attention
|
239
|
+
end
|
240
|
+
|
241
|
+
##
|
242
|
+
# Returns the last state reported for the specified key to the window.
|
243
|
+
#
|
244
|
+
# @param key [Integer] The key to query.
|
245
|
+
#
|
246
|
+
# @return [Boolean] `true` if key is depressed, otherwise `false`.
|
247
|
+
# @see button?
|
248
|
+
# @see on_key
|
249
|
+
def key?(key)
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Returns the last state reported for the specified mouse button to the window.
|
254
|
+
#
|
255
|
+
# @param key [Integer] The mouse button to query.
|
256
|
+
#
|
257
|
+
# @return [Boolean] `true` if mouse button is depressed, otherwise `false`.
|
258
|
+
# @see key?
|
259
|
+
# @see on_mouse_button
|
260
|
+
def button?(button)
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# Ssets the monitor that the window uses for full screen mode or, if the monitor is `nil`,
|
265
|
+
# makes it windowed mode.
|
266
|
+
#
|
267
|
+
# When setting a monitor, this function updates the width, height and refresh rate of the
|
268
|
+
# desired video mode and switches to the video mode closest to it. The window position is
|
269
|
+
# ignored when setting a monitor.
|
270
|
+
#
|
271
|
+
# When the monitor is `nil`, the position, width and height are used to place the window
|
272
|
+
# content area. The refresh rate is ignored when no monitor is specified.
|
273
|
+
#
|
274
|
+
# When a window transitions from full screen to windowed mode, this function restores any previous
|
275
|
+
# window settings such as whether it is decorated, floating, resizable, has size or aspect
|
276
|
+
# ratio limits, etc.
|
277
|
+
#
|
278
|
+
# @param monitor [Monitor?] The desired monitor, or `nil` to set windowed mode.
|
279
|
+
# @param position [Point] The desired location of the upper-left corner of the content area.
|
280
|
+
# @param size [Size] The desired size in screen coordinates of the content area or video mode.
|
281
|
+
# @param hz [Integer] The desired refresh rate, in Hz, of the video mode, or `-1` to ignore.
|
282
|
+
#
|
283
|
+
# @return [void]
|
284
|
+
def change_monitor(monitor, position, size, hz = -1)
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# @return [String?] the window caption displayed in the system menubar, window titlebar, etc.
|
289
|
+
attr_accessor :title
|
290
|
+
|
291
|
+
##
|
292
|
+
# @return [Boolean] the visibility state of the window.
|
293
|
+
attr_accessor :visible
|
294
|
+
|
295
|
+
##
|
296
|
+
# @return [Boolean] `true` if window is floating (always-on-top) of other application windows, otherwise `false`.
|
297
|
+
attr_accessor :topmost
|
298
|
+
|
299
|
+
##
|
300
|
+
# The icon(s) to be displayed as a window decoration, on systems that support this functionality.
|
301
|
+
# @return [Image, Array<Image>] an image or array of possible images.
|
302
|
+
attr_accessor :icon
|
303
|
+
|
304
|
+
##
|
305
|
+
# @return [Point] the position of the top-left corner of the window's client area, in screen coordinates.
|
306
|
+
attr_accessor :position
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [Size] the size of the window's client area, in screen coordinates.
|
310
|
+
attr_accessor :size
|
311
|
+
|
312
|
+
##
|
313
|
+
# @return [Cursor?] the mouse cursor the window uses, or `nil` if not specified.
|
314
|
+
attr_accessor :cursor
|
315
|
+
|
316
|
+
##
|
317
|
+
# @return [Vec2] the location of the mouse cursor.
|
318
|
+
attr_accessor :cursor_pos
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [Float] a value determining the visibility of the window (including frame), where `0.0` is invisible and `1.0` is fully opaque.
|
322
|
+
attr_accessor :opacity
|
323
|
+
|
324
|
+
##
|
325
|
+
# @return [Boolean] a value indicating if the window will be decoarted with a frame, close widget, etc.
|
326
|
+
attr_accessor :decorated
|
327
|
+
|
328
|
+
##
|
329
|
+
# @return [Boolean] a value indicating if window is resizable by the user.
|
330
|
+
attr_accessor :resizable
|
331
|
+
|
332
|
+
##
|
333
|
+
# @return [String?] a string for the clipboard associated with the window.
|
334
|
+
attr_accessor :clipboard
|
335
|
+
|
336
|
+
##
|
337
|
+
# @return [Boolean] a value indicating if window will automatically focus when being restored from minimized state, etc.
|
338
|
+
attr_accessor :auto_focus
|
339
|
+
|
340
|
+
##
|
341
|
+
# @return [Integer] a value indicating the behavior of the mouse cursor.
|
342
|
+
# @see CURSOR_NORMAL
|
343
|
+
# @see CURSOR_HIDDEN
|
344
|
+
# @see CURSOR_DISABLED
|
345
|
+
attr_accessor :cursor_mode
|
346
|
+
|
347
|
+
##
|
348
|
+
# @return [Boolean] a value indicating if input states for keys will persist until queried with {key?}.
|
349
|
+
attr_accessor :sticky_keys
|
350
|
+
|
351
|
+
##
|
352
|
+
# @return [Boolean] a value indicating if input states for mouse buttons will persist until queried with {button?}.
|
353
|
+
attr_accessor :sticky_buttons
|
354
|
+
|
355
|
+
##
|
356
|
+
# @return [Boolean] a value indicating if modifier bits for input callback functions will include {MOD_CAPS_LOCK}, {MOD_NUM_LOCK}, etc.
|
357
|
+
attr_accessor :lock_modifiers
|
358
|
+
|
359
|
+
##
|
360
|
+
# When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can be enabled if available.
|
361
|
+
#
|
362
|
+
# Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the
|
363
|
+
# scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a
|
364
|
+
# cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse
|
365
|
+
# motion is only provided when the cursor is disabled.
|
366
|
+
#
|
367
|
+
# @return [Boolean] `true` if raw mouse motion is enabled, otherwise `false`.
|
368
|
+
attr_accessor :raw_mouse_motion
|
369
|
+
|
370
|
+
##
|
371
|
+
# @return [Monitor?] the monitor the window is displayed on, or `nil` if not a fullscreen window.
|
372
|
+
attr_reader :monitor
|
373
|
+
|
374
|
+
##
|
375
|
+
# @return [Vec2] the current content scale of the window.
|
376
|
+
attr_reader :content_scale
|
377
|
+
|
378
|
+
##
|
379
|
+
# @return [Size] the dimensions of the window's primary framebuffer, in pixel coordinates.
|
380
|
+
attr_reader :framebuffer_size
|
381
|
+
|
382
|
+
# @!group Callback Functions
|
383
|
+
|
384
|
+
##
|
385
|
+
# @overload on_framebuffer_resize(&block)
|
386
|
+
# When called with a block, sets a callback to be invoked when the window's framebuffer size changes.
|
387
|
+
# @yieldparam width [Integer] The new width of the framebuffer, in pixel units.
|
388
|
+
# @yieldparam height [Integer] The new height of the framebuffer, in pixel units.
|
389
|
+
#
|
390
|
+
# @overload on_framebuffer_resize
|
391
|
+
# When called without a block, clears any callback that is set.
|
392
|
+
#
|
393
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
394
|
+
# @see framebuffer_size
|
395
|
+
def on_framebuffer_resize
|
396
|
+
end
|
397
|
+
|
398
|
+
##
|
399
|
+
# @overload on_resize(&block)
|
400
|
+
# When called with a block, sets a callback to be invoked when the window size changes.
|
401
|
+
# @yieldparam width [Integer] The new width of the window's client area, in screen coordinates.
|
402
|
+
# @yieldparam height [Integer] The new height of the window's client area, in screen coordinates.
|
403
|
+
#
|
404
|
+
# @overload on_resize
|
405
|
+
# When called without a block, clears any callback that is set.
|
406
|
+
#
|
407
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
408
|
+
# @see size
|
409
|
+
def on_resize
|
410
|
+
end
|
411
|
+
|
412
|
+
##
|
413
|
+
# @overload on_move(&block)
|
414
|
+
# When called with a block, sets a callback to be invoked when the window's position is changed.
|
415
|
+
# @yieldparam x [Integer] The new position of the window on the x-axis, in screen coordinates.
|
416
|
+
# @yieldparam y [Integer] The new position of the window on the y-axis, in screen coordinates.
|
417
|
+
#
|
418
|
+
# @overload on_move
|
419
|
+
# When called without a block, clears any callback that is set.
|
420
|
+
#
|
421
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
422
|
+
# @see position
|
423
|
+
def on_move
|
424
|
+
end
|
425
|
+
|
426
|
+
##
|
427
|
+
# @overload on_focus(&block)
|
428
|
+
# When called with a block, sets a callback to be invoked when the window gains or loses input focus.
|
429
|
+
# @yieldparam focused [Boolean] `true` if window has gained focus, otherwise `false` if it was lost.
|
430
|
+
#
|
431
|
+
# @overload on_focus
|
432
|
+
# When called without a block, clears any callback that is set.
|
433
|
+
#
|
434
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
435
|
+
# @see focus
|
436
|
+
# @see focused?
|
437
|
+
def on_focus
|
438
|
+
end
|
439
|
+
|
440
|
+
##
|
441
|
+
# @overload on_refresh(&block)
|
442
|
+
# When called with a block, sets a callback to be invoked when the content area of the window needs
|
443
|
+
# to be redrawn, for example if the window has been exposed after having been covered by another window.
|
444
|
+
# @yield No arguments are yielded to the block.
|
445
|
+
#
|
446
|
+
# @overload on_refresh
|
447
|
+
# When called without a block, clears any callback that is set.
|
448
|
+
#
|
449
|
+
# @note On compositing window systems such as Aero, Compiz, Aqua or Wayland, where the window contents
|
450
|
+
# are saved off-screen, this callback may be called only very infrequently or never at all.
|
451
|
+
#
|
452
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
453
|
+
def on_refresh
|
454
|
+
end
|
455
|
+
|
456
|
+
##
|
457
|
+
# @overload on_close(&block)
|
458
|
+
# When called with a block, sets a callback to be invoked when the window is flagged to close.
|
459
|
+
# @yield No arguments are yielded to the block.
|
460
|
+
#
|
461
|
+
# @overload on_close
|
462
|
+
# When called without a block, clears any callback that is set.
|
463
|
+
#
|
464
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
465
|
+
# @see close
|
466
|
+
# @see closing?
|
467
|
+
def on_close
|
468
|
+
end
|
469
|
+
|
470
|
+
##
|
471
|
+
# @overload on_minimize(&block)
|
472
|
+
# When called with a block, sets a callback to be invoked when the window minimized or restored.
|
473
|
+
# @yieldparam minimized [Boolean] `true` if window has been minimized, otherwise `false` if being restored.
|
474
|
+
#
|
475
|
+
# @overload on_minimize
|
476
|
+
# When called without a block, clears any callback that is set.
|
477
|
+
#
|
478
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
479
|
+
# @see minimize
|
480
|
+
# @see minimized?
|
481
|
+
def on_minimize
|
482
|
+
end
|
483
|
+
|
484
|
+
##
|
485
|
+
# @overload on_maximize(&block)
|
486
|
+
# When called with a block, sets a callback to be invoked when the window maximized or restored.
|
487
|
+
# @yieldparam maximized [Boolean] `true` if window has been maximized, otherwise `false` if being restored.
|
488
|
+
#
|
489
|
+
# @overload on_maximize
|
490
|
+
# When called without a block, clears any callback that is set.
|
491
|
+
#
|
492
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
493
|
+
# @see maximize
|
494
|
+
# @see maximized?
|
495
|
+
def on_maximize
|
496
|
+
end
|
497
|
+
|
498
|
+
##
|
499
|
+
# @overload on_file_drop(&block)
|
500
|
+
# When called with a block, sets a callback to be invoked when a files/folders are drag-dropped onto
|
501
|
+
# the windows client area.
|
502
|
+
# @yieldparam paths [Array<String>] An array of the absolite paths of the filepaths that were dropped.
|
503
|
+
#
|
504
|
+
# @overload on_file_drop
|
505
|
+
# When called without a block, clears any callback that is set.
|
506
|
+
#
|
507
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
508
|
+
def on_file_drop
|
509
|
+
end
|
510
|
+
|
511
|
+
##
|
512
|
+
# @overload on_cursor_move(&block)
|
513
|
+
# When called with a block, sets a callback to be invoked when the mouse cursor moves.
|
514
|
+
# @yieldparam x [Float] The new cursor position on the x-axis, in screen coordinates and
|
515
|
+
# relative to the top-left corner of the window's client area.
|
516
|
+
# @yieldparam y [Float] The new cursor position on the y-axis, in screen coordinates and
|
517
|
+
# relative to the top-left corner of the window's client area.
|
518
|
+
#
|
519
|
+
# @overload on_cursor_move
|
520
|
+
# When called without a block, clears any callback that is set.
|
521
|
+
#
|
522
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
523
|
+
# @see cursor_pos
|
524
|
+
# @see move_cursor
|
525
|
+
def on_cursor_move
|
526
|
+
end
|
527
|
+
|
528
|
+
##
|
529
|
+
# @overload on_scroll(&block)
|
530
|
+
# When called with a block, sets a callback to be invoked when the mouse wheel is scrolled.
|
531
|
+
# @yieldparam x [Float] The scroll amount on the x-axis, or `0.0` when not supported.
|
532
|
+
# @yieldparam y [Float] The scroll amount on the y-axis.
|
533
|
+
#
|
534
|
+
# @overload on_scroll
|
535
|
+
# When called without a block, clears any callback that is set.
|
536
|
+
#
|
537
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
538
|
+
def on_scroll
|
539
|
+
end
|
540
|
+
|
541
|
+
##
|
542
|
+
# @overload on_key(&block)
|
543
|
+
# When called with a block, sets a callback to be invoked when a key state changes.
|
544
|
+
# @yieldparam key [Integer] The keyboard key that was pressed or released.
|
545
|
+
# @yieldparam scancode [Integer] The system-specific scancode of the key.
|
546
|
+
# @yieldparam action [Integer] A value indicating the state of the key
|
547
|
+
# @yieldparam modifiers [Integer] A bitfield value of modifier keys that were present during the action.
|
548
|
+
#
|
549
|
+
# @overload on_key
|
550
|
+
# When called without a block, clears any callback that is set.
|
551
|
+
#
|
552
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
553
|
+
# @see key?
|
554
|
+
# @see RELEASE
|
555
|
+
# @see PRESS
|
556
|
+
# @see REPEAT
|
557
|
+
def on_key
|
558
|
+
end
|
559
|
+
|
560
|
+
##
|
561
|
+
# @overload on_mouse_button(&block)
|
562
|
+
# When called with a block, sets a callback to be invoked when a mouse button state changes.
|
563
|
+
# @yieldparam button [Integer] The mouse button that was pressed or released.
|
564
|
+
# @yieldparam action [Integer] A value indicating the state of the button.
|
565
|
+
# @yieldparam modifiers [Integer] A bitfield value of modifier keys that were present during the action.
|
566
|
+
#
|
567
|
+
# @overload on_mouse_button
|
568
|
+
# When called without a block, clears any callback that is set.
|
569
|
+
#
|
570
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
571
|
+
# @see button?
|
572
|
+
# @see RELEASE
|
573
|
+
# @see PRESS
|
574
|
+
# @see REPEAT
|
575
|
+
def on_mouse_button
|
576
|
+
end
|
577
|
+
|
578
|
+
##
|
579
|
+
# @overload on_cursor_enter(&block)
|
580
|
+
# When called with a block, sets a callback to be invoked when the mouse cursor enters or leaves
|
581
|
+
# the content area of the window.
|
582
|
+
# @yieldparam entered [Booleab] `true` if cursor is entering the window, otherwise `false` when leaving.
|
583
|
+
#
|
584
|
+
# @overload on_cursor_enter
|
585
|
+
# When called without a block, clears any callback that is set.
|
586
|
+
#
|
587
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
588
|
+
def on_cursor_enter
|
589
|
+
end
|
590
|
+
|
591
|
+
##
|
592
|
+
# The character callback is intended for Unicode text input. As it deals with characters, it is keyboard
|
593
|
+
# layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys, as a key
|
594
|
+
# may produce zero, one or more characters. If you want to know whether a specific physical key was pressed
|
595
|
+
# or released, see the key callback instead.
|
596
|
+
#
|
597
|
+
# The character callback behaves as system text input normally does and will not be called if modifier keys
|
598
|
+
# are held down that would prevent normal text input on that platform, for example a Super (Command) key on
|
599
|
+
# macOS or Alt key on Windows.
|
600
|
+
#
|
601
|
+
# @overload on_char(&block)
|
602
|
+
# When called with a block, sets a callback to be invoked when a Unicode character is input.
|
603
|
+
# @yieldparam codepoint [Integer] A Unicode codepoint.
|
604
|
+
#
|
605
|
+
# @overload on_char
|
606
|
+
# When called without a block, clears any callback that is set.
|
607
|
+
#
|
608
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
609
|
+
def on_char
|
610
|
+
end
|
611
|
+
|
612
|
+
##
|
613
|
+
# @overload on_scale(&block)
|
614
|
+
# When called with a block, sets a callback to be invoked when the window's content scale is changed.
|
615
|
+
# @yieldparam x [Float] The new content scaling factor on the x-axis.
|
616
|
+
# @yieldparam y [Float] The new content scaling factor on the y-axis.
|
617
|
+
#
|
618
|
+
# @overload on_scale
|
619
|
+
# When called without a block, clears any callback that is set.
|
620
|
+
#
|
621
|
+
# @return [Proc?] the previous callback that was set, or `nil` if none existed.
|
622
|
+
# @see content_scale
|
623
|
+
def on_scale
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|