solargraph-dragonruby 0.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 +7 -0
- data/CHANGELOG.md +56 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/NOTICE +8 -0
- data/README.md +185 -0
- data/Rakefile +13 -0
- data/lib/solargraph/dragonruby/convention.rb +43 -0
- data/lib/solargraph/dragonruby/macro_node.rb +44 -0
- data/lib/solargraph/dragonruby/version.rb +7 -0
- data/lib/solargraph/dragonruby.rb +15 -0
- data/lib/solargraph-dragonruby.rb +5 -0
- data/sig/solargraph/dragonruby.rbs +19 -0
- data/stubs/extensions/README.md +20 -0
- data/stubs/extensions/args.rb +91 -0
- data/stubs/extensions/array.rb +25 -0
- data/stubs/extensions/attr.rb +249 -0
- data/stubs/extensions/easing.rb +90 -0
- data/stubs/extensions/entity.rb +63 -0
- data/stubs/extensions/geometry.rb +528 -0
- data/stubs/extensions/grid.rb +247 -0
- data/stubs/extensions/inputs.rb +678 -0
- data/stubs/extensions/layout.rb +175 -0
- data/stubs/extensions/log.rb +158 -0
- data/stubs/extensions/main.rb +63 -0
- data/stubs/extensions/numeric.rb +395 -0
- data/stubs/extensions/outputs.rb +132 -0
- data/stubs/extensions/runtime.rb +436 -0
- data/stubs/extensions/string.rb +85 -0
- data/stubs/extensions/typing.rb +193 -0
- data/stubs/extensions/zlib.rb +24 -0
- data/stubs/upstream/LICENSE.txt +21 -0
- data/stubs/upstream/UPSTREAM +2 -0
- data/stubs/upstream/args.rb +61 -0
- data/stubs/upstream/constants.rb +8 -0
- data/stubs/upstream/controller.rb +90 -0
- data/stubs/upstream/easing.rb +119 -0
- data/stubs/upstream/geometry.rb +430 -0
- data/stubs/upstream/globals.rb +17 -0
- data/stubs/upstream/gtk.rb +476 -0
- data/stubs/upstream/inputs.rb +286 -0
- data/stubs/upstream/kernel.rb +7 -0
- data/stubs/upstream/keyboard.rb +38 -0
- data/stubs/upstream/layout.rb +32 -0
- data/stubs/upstream/numeric.rb +82 -0
- data/stubs/upstream/outputs.rb +55 -0
- data/stubs/upstream/outputs_array.rb +4 -0
- data/stubs/upstream/phantom_types.rb +25 -0
- data/stubs/upstream/toplevel.rb +13 -0
- metadata +107 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Inputs
|
|
3
|
+
# This function returns the last active input which will be set to either :keyboard, :mouse, or :controller.
|
|
4
|
+
#
|
|
5
|
+
# The function is helpful when you need to present on screen instructions based on the input the player chose to play with.
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# if args.inputs.last_active == :controller
|
|
9
|
+
# args.outputs.labels << { x: 60, y: 60, text: "Use the D-Pad to move around." }
|
|
10
|
+
# else
|
|
11
|
+
# args.outputs.labels << { x: 60, y: 60, text: "Use the arrow keys to move around." }
|
|
12
|
+
# end
|
|
13
|
+
# ```
|
|
14
|
+
#
|
|
15
|
+
# @return [Symbol] returns the last active controller. Will return one of :keyboard, :mouse, or :controller
|
|
16
|
+
attr_reader :last_active
|
|
17
|
+
|
|
18
|
+
# @return [Integer] Returns Kernel.tick_count of which the specific input was last active.
|
|
19
|
+
attr_reader :last_active_at
|
|
20
|
+
|
|
21
|
+
# @return [Integer] Returns the Kernel.global_tick_count of which the specific input was last active.
|
|
22
|
+
attr_reader :last_active_global_at
|
|
23
|
+
|
|
24
|
+
# Refer to the following link for locale strings: [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
|
25
|
+
#
|
|
26
|
+
# Defaults to 'en' if locale can’t be retrieved (args.inputs.locale_raw will be nil in this case).
|
|
27
|
+
#
|
|
28
|
+
# @return [String] Returns the ISO 639-1 two-letter langauge code based on OS preferences.
|
|
29
|
+
# @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes Wikipedia list of ISO 639-1 codes
|
|
30
|
+
attr_reader :locale
|
|
31
|
+
|
|
32
|
+
# @return [Integer, nil] Returns the tickstamp of the keypress if: the up arrow or w key is pressed or held on the keyboard; or if up is pressed or held on controller_one; or if the left_analog on controller_one is tilted upwards.
|
|
33
|
+
def up; end
|
|
34
|
+
|
|
35
|
+
# @return [Integer, nil] Returns the tickstamp of the keypress if: the down arrow or s key is pressed or held on the keyboard; or if down is pressed or held on controller_one; or if the left_analog on controller_one is tilted downwards.
|
|
36
|
+
def down; end
|
|
37
|
+
|
|
38
|
+
# @return [Integer, nil] Returns the tickstamp of the keypress if: the left arrow or a key is pressed or held on the keyboard; or if left is pressed or held on controller_one; or if the left_analog on controller_one is tilted to the left.
|
|
39
|
+
def left; end
|
|
40
|
+
|
|
41
|
+
# @return [Integer, nil] Returns the tickstamp of the keypress if: the right arrow or d key is pressed or held on the keyboard; or if right is pressed or held on controller_one; or if the left_analog on controller_one is tilted to the right.
|
|
42
|
+
def right; end
|
|
43
|
+
|
|
44
|
+
# This method is aliased to +args.inputs.left_right_with_wasd+.
|
|
45
|
+
#
|
|
46
|
+
# The following inputs are inspected to determine the result:
|
|
47
|
+
#
|
|
48
|
+
# * Keyboard's left, right arrow keys: args.inputs.keyboard.(left\|right)_arrow
|
|
49
|
+
# * Keyboard's a, d keys (WASD): args.inputs.keyboard.(a\|d)
|
|
50
|
+
# * Controller One's DPAD (if a controller is connected): args.inputs.controller_one.dpad_left, args.inputs.controller_one.dpad_right
|
|
51
|
+
# * Controller One's Left Analog (if a controller is connected): args.inputs.controller_one.left_analog_x_perc.abs >= 0.6
|
|
52
|
+
#
|
|
53
|
+
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right).
|
|
54
|
+
def left_right; end
|
|
55
|
+
|
|
56
|
+
# This method is aliased to args.inputs.left_right_perc_with_wasd
|
|
57
|
+
#
|
|
58
|
+
# The following inputs are inspected to dermine the result:
|
|
59
|
+
#
|
|
60
|
+
# * Controller One’s Left Analog (if a controller is connected and the value is not 0.0): args.inputs.controller_one.left_analog_x_perc
|
|
61
|
+
# * If the left analog isn’t being used, then Controller One’s DPAD is consulted: args.inputs.controller_one.dpad_left, args.inputs.controller_one.dpad_right
|
|
62
|
+
# * Keyboard’s a, d keys (WASD): args.inputs.keyboard.(a\d)
|
|
63
|
+
# * Keyboard’s left/right arrow keys: args.inputs.keyboard.(left\|right)_arrow
|
|
64
|
+
#
|
|
65
|
+
# @return [Float] Returns a floating point value between -1 and 1
|
|
66
|
+
def left_right_perc; end
|
|
67
|
+
|
|
68
|
+
# This method is aliased to args.inputs.left_right_arrow.
|
|
69
|
+
#
|
|
70
|
+
# The following inputs are inspected to determine the result:
|
|
71
|
+
#
|
|
72
|
+
# * Keyboard’s left/right arrow keys: args.inputs.keyboard.(left\|right)_arrow
|
|
73
|
+
# * Controller One’s DPAD (if a controller is connected): args.inputs.controller_one.dpad_left, args.inputs.controller_one.dpad_right
|
|
74
|
+
#
|
|
75
|
+
# WASD and Controller One’s Left Analog Stick are NOT consulted.
|
|
76
|
+
#
|
|
77
|
+
# @ return [Integer] Returns -1 (left), 0 (neutral), or +1 (right).
|
|
78
|
+
def left_right_directional; end
|
|
79
|
+
|
|
80
|
+
# The following inputs are inspected to dermine the result:
|
|
81
|
+
#
|
|
82
|
+
# * Controller One’s Left Analog (if a controller is connected and the value is not 0.0): args.inputs.controller_one.left_analog_x_perc
|
|
83
|
+
# * If the left analog isn’t being used, then Controller One’s DPAD is consulted: args.inputs.controller_one.dpad_left, args.inputs.controller_one.dpad_right
|
|
84
|
+
# * Keyboard’s left/right arrow keys: args.inputs.keyboard.(left\|right)_arrow
|
|
85
|
+
#
|
|
86
|
+
# WASD is NOT consulted.
|
|
87
|
+
#
|
|
88
|
+
# @ return [Float] Returns a floating point value between -1 and 1.
|
|
89
|
+
def left_right_directional_perc; end
|
|
90
|
+
|
|
91
|
+
# This method is aliased to args.inputs.up_down_with_wasd.
|
|
92
|
+
#
|
|
93
|
+
# The following inputs are inspected to determine the result:
|
|
94
|
+
#
|
|
95
|
+
# * Keyboard’s up/down arrow keys: args.inputs.keyboard.(up\|down)_arrow
|
|
96
|
+
# * Keyboard’s w, s keys (WASD): args.inputs.keyboard.(w\|s)
|
|
97
|
+
# * Controller One’s DPAD (if a controller is connected): args.inputs.controller_one.dpad_up, args.inputs.controller_one.dpad_down
|
|
98
|
+
# * Controller One’s Up Analog (if a controller is connected): args.inputs.controller_one.up_analog_y_perc.abs >= 0.6
|
|
99
|
+
#
|
|
100
|
+
# @return [Integer] Returns -1 (down), 0 (neutral), or +1 (up).
|
|
101
|
+
def up_down; end
|
|
102
|
+
|
|
103
|
+
# This method is aliased to args.inputs.up_down_arrow.
|
|
104
|
+
#
|
|
105
|
+
# The following inputs are inspected to determine the result:
|
|
106
|
+
#
|
|
107
|
+
# * Keyboard’s up/down arrow keys: args.inputs.keyboard.(up\|down)_arrow
|
|
108
|
+
# * Controller One’s DPAD (if a controller is connected): args.inputs.controller_one.dpad_up, args.inputs.controller_one.dpad_down
|
|
109
|
+
#
|
|
110
|
+
# WASD and Controller One’s Left Analog Stick are NOT consulted.
|
|
111
|
+
#
|
|
112
|
+
# @return [Integer] Returns -1 (down), 0 (neutral), or +1 (up).
|
|
113
|
+
def up_down_directional; end
|
|
114
|
+
|
|
115
|
+
# The following inputs are inspected to dermine the result:
|
|
116
|
+
#
|
|
117
|
+
# * Controller One’s Left Analog (if a controller is connected and the value is not 0.0): args.inputs.controller_one.up_analog_y_perc
|
|
118
|
+
# * If the left analog isn’t being used, then Controller One’s DPAD is consulted: args.inputs.controller_one.dpad_up, args.inputs.controller_one.dpad_down
|
|
119
|
+
# * Keyboard’s up/down arrow keys: args.inputs.keyboard.(up\|down)_arrow
|
|
120
|
+
#
|
|
121
|
+
# @return [Float] Returns a floating point value between -1 and 1.
|
|
122
|
+
def up_down_perc; end
|
|
123
|
+
|
|
124
|
+
# @return [String] Returns a string that represents the last key that was pressed on the keyboard.
|
|
125
|
+
def text; end
|
|
126
|
+
|
|
127
|
+
# @return [GTK::Mouse]
|
|
128
|
+
attr_reader :mouse
|
|
129
|
+
|
|
130
|
+
# @return [Hash] Returns a Hash representing all touch points on a touch device.
|
|
131
|
+
attr_reader :touch
|
|
132
|
+
|
|
133
|
+
# @return [Hash] Returns a Hash with x and y denoting a touch point that is on the left side of the screen.
|
|
134
|
+
attr_reader :finger_left
|
|
135
|
+
|
|
136
|
+
# @return [Hash] Returns a Hash with x and y denoting a touch point that is on the right side of the screen.
|
|
137
|
+
attr_reader :finger_right
|
|
138
|
+
|
|
139
|
+
# @return [GTK::Controller] controller one
|
|
140
|
+
attr_reader :controller_one
|
|
141
|
+
|
|
142
|
+
# @return [GTK::Controller] controller two
|
|
143
|
+
attr_reader :controller_two
|
|
144
|
+
|
|
145
|
+
# @return [GTK::Controller] controller three
|
|
146
|
+
attr_reader :controller_three
|
|
147
|
+
|
|
148
|
+
# @return [GTK::Controller] controller four
|
|
149
|
+
attr_reader :controller_four
|
|
150
|
+
|
|
151
|
+
# @return [Array<GTK::Controller>] array of connected Controllers
|
|
152
|
+
attr_reader :controllers
|
|
153
|
+
|
|
154
|
+
# @return [GTK::Keyboard] keyboard
|
|
155
|
+
attr_reader :keyboard
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
class MousePoint
|
|
159
|
+
include Typing::Point
|
|
160
|
+
|
|
161
|
+
# @return [Typing::Rect] hash containing the x, y position of the click, and a w, h that are always 0.
|
|
162
|
+
attr_reader :point
|
|
163
|
+
|
|
164
|
+
# @return [Integer] the tick_count this click occurred at.
|
|
165
|
+
attr_reader :created_at
|
|
166
|
+
|
|
167
|
+
# @return [Integer] the global_tick_count this click occurred at.
|
|
168
|
+
attr_reader :global_created_at
|
|
169
|
+
|
|
170
|
+
# @return [Integer] Returns the number of ticks between current time and when this click occurred.
|
|
171
|
+
def created_at_elapsed; end
|
|
172
|
+
|
|
173
|
+
# @return [Integer] always returns 0
|
|
174
|
+
def w; end
|
|
175
|
+
|
|
176
|
+
# @return [Integer] always returns 0
|
|
177
|
+
def h; end
|
|
178
|
+
|
|
179
|
+
# @return [Integer] returns the x coordinate of the click
|
|
180
|
+
def left; end
|
|
181
|
+
|
|
182
|
+
# @return [Integer] returns the x coordinate of the click
|
|
183
|
+
def right; end
|
|
184
|
+
|
|
185
|
+
# @return [Integer] returns the y coordinate of the click
|
|
186
|
+
def top; end
|
|
187
|
+
|
|
188
|
+
# @return [Integer] returns the y coordinate of the click
|
|
189
|
+
def bottom; end
|
|
190
|
+
|
|
191
|
+
# Check if the click is inside a rect
|
|
192
|
+
#
|
|
193
|
+
# @param rect [Object] a primitive that responds to x, y, w, h
|
|
194
|
+
# @return [Boolean] Returns true if the click is inside the specified rect
|
|
195
|
+
def inside_rect? rect; end
|
|
196
|
+
|
|
197
|
+
# Check if the click is inside a circle
|
|
198
|
+
#
|
|
199
|
+
# @param center_point [Object] any primitive that responds to x, y
|
|
200
|
+
# @param radius [Float] radius of circle
|
|
201
|
+
# @return [Boolean] Returns true if the click is inside of a specified circle.
|
|
202
|
+
def inside_circle? center_point, radius; end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
class Mouse
|
|
206
|
+
# @return [Boolean] Return’s true if the game has mouse focus.
|
|
207
|
+
attr_reader :has_focus
|
|
208
|
+
|
|
209
|
+
# @return [Integer] Returns the current x location of the mouse.
|
|
210
|
+
attr_reader :x
|
|
211
|
+
|
|
212
|
+
# @return [Integer] Returns the current y location of the mouse.
|
|
213
|
+
attr_reader :y
|
|
214
|
+
|
|
215
|
+
# @return [Integer] Returns the x location of the mouse on the previous frame.
|
|
216
|
+
attr_reader :previous_x
|
|
217
|
+
|
|
218
|
+
# @return [Integer] Returns the y location of the mouse on the previous frame.
|
|
219
|
+
attr_reader :previous_y
|
|
220
|
+
|
|
221
|
+
# @return [Integer] Returns the difference between the current x location of the mouse and its previous x location.
|
|
222
|
+
attr_reader :relative_x
|
|
223
|
+
|
|
224
|
+
# @return [Integer] Returns the difference between the current y location of the mouse and its previous y location.
|
|
225
|
+
attr_reader :relative_y
|
|
226
|
+
|
|
227
|
+
# Check if the mouse is inside a rect
|
|
228
|
+
#
|
|
229
|
+
# @param rect [Typing::Rect] a primitive that responds to x, y, w, h
|
|
230
|
+
# @return [Boolean] Returns true if the mouse is inside the specified rect
|
|
231
|
+
def inside_rect? rect; end
|
|
232
|
+
|
|
233
|
+
# Check if the mouse is inside a circle
|
|
234
|
+
#
|
|
235
|
+
# @param center_point [Typing::Point] any primitive that responds to x, y
|
|
236
|
+
# @param radius [Float] radius of circle
|
|
237
|
+
# @return [Boolean] Returns true if the mouse is inside of a specified circle.
|
|
238
|
+
def inside_circle? center_point, radius; end
|
|
239
|
+
|
|
240
|
+
# @return [Boolean] Returns true if the mouse has moved on the current frame.
|
|
241
|
+
attr_reader :moved
|
|
242
|
+
|
|
243
|
+
# @return [Boolean] Returns true if the left mouse button is down.
|
|
244
|
+
attr_reader :button_left
|
|
245
|
+
|
|
246
|
+
# @return [Boolean] Returns true if the middle mouse button is down.
|
|
247
|
+
attr_reader :button_middle
|
|
248
|
+
|
|
249
|
+
# @return [Boolean] Returns true if the right mouse button is down.
|
|
250
|
+
attr_reader :button_right
|
|
251
|
+
|
|
252
|
+
# @return [Integer] Returns a bitmask for all buttons on the mouse: 1 for a button in the down state, 0 for a button in the up state.
|
|
253
|
+
attr_reader :button_bits
|
|
254
|
+
|
|
255
|
+
# @return [Hash, nil] Returns nil if no mouse wheel actions occurred. Otherwise returns a Hash with x and y (representing movement on each axis).
|
|
256
|
+
attr_reader :wheel
|
|
257
|
+
|
|
258
|
+
# Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
259
|
+
#
|
|
260
|
+
# To scope to a specific button use .button_left, .button_middle, .button_right, or .button_bits.
|
|
261
|
+
#
|
|
262
|
+
# @return [GTK::MousePoint, nil] Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
263
|
+
def click; end
|
|
264
|
+
|
|
265
|
+
# Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
266
|
+
#
|
|
267
|
+
# To scope to a specific button use .button_left, .button_middle, .button_right, or .button_bits.
|
|
268
|
+
#
|
|
269
|
+
# @return [GTK::MousePoint, nil] Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
270
|
+
def down; end
|
|
271
|
+
|
|
272
|
+
# Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
273
|
+
#
|
|
274
|
+
# To scope to a specific button use .button_left, .button_middle, .button_right, or .button_bits.
|
|
275
|
+
#
|
|
276
|
+
# @return [GTK::MousePoint, nil] Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
277
|
+
def previous_click; end
|
|
278
|
+
|
|
279
|
+
# Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
280
|
+
#
|
|
281
|
+
# To scope to a specific button use .button_left, .button_middle, .button_right, or .button_bits.
|
|
282
|
+
#
|
|
283
|
+
# @return [GTK::MousePoint, nil] Returns nil if the button event didn't occur this frame, else returns a MousePoint, which includes x, y properties along with helper functions to determine collision: inside_rect?, inside_circle?.
|
|
284
|
+
def up; end
|
|
285
|
+
end
|
|
286
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Keyboard
|
|
3
|
+
|
|
4
|
+
# @return [Integer] Returns Kernel.tick_count if any keys on the keyboard were pressed.
|
|
5
|
+
attr_reader :active
|
|
6
|
+
|
|
7
|
+
# @return [Boolean] Returns true if the game has keyboard focus.
|
|
8
|
+
attr_reader :has_focus
|
|
9
|
+
|
|
10
|
+
# @return [Integer, false] Returns the tickstamp of the keypress if up or w is pressed or held on the keyboard.
|
|
11
|
+
attr_reader :up
|
|
12
|
+
|
|
13
|
+
# @return [Integer, false] Returns the tickstamp of the keypress if down or s is pressed or held on the keyboard.
|
|
14
|
+
attr_reader :down
|
|
15
|
+
|
|
16
|
+
# @return [Integer, false] Returns the tickstamp of the keypress if left or a is pressed or held on the keyboard.
|
|
17
|
+
attr_reader :left
|
|
18
|
+
|
|
19
|
+
# @return [Integer, false] Returns the tickstamp of the keypress if right or d is pressed or held on the keyboard.
|
|
20
|
+
attr_reader :right
|
|
21
|
+
|
|
22
|
+
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #left and #right.
|
|
23
|
+
attr_reader :left_right
|
|
24
|
+
|
|
25
|
+
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #up and #up.
|
|
26
|
+
attr_reader :up_down
|
|
27
|
+
|
|
28
|
+
attr_reader :key_down
|
|
29
|
+
|
|
30
|
+
attr_reader :key_held
|
|
31
|
+
|
|
32
|
+
attr_reader :key_up
|
|
33
|
+
|
|
34
|
+
# @return [Hash] Returns a Hash with all keys on the keyboard in their respective state.
|
|
35
|
+
# The Hash contains the following keys: :down, :held, :down_or_held, :up
|
|
36
|
+
attr_reader :keys
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
# Layout provides apis for placing primitives on a virtual grid that’s within the “safe area” accross all platforms.
|
|
3
|
+
#
|
|
4
|
+
# This virtual grid is useful for rendering static controls (buttons, menu items, configuration screens, etc).
|
|
5
|
+
#
|
|
6
|
+
# The virtual grid is 12 rows by 24 columns (or 24 columns by 12 rows in portrait mode).
|
|
7
|
+
class Layout
|
|
8
|
+
class << self
|
|
9
|
+
# Given a row:, col:, w:, h:, returns a Hash with properties x, y, w, h, and center (which contains a Hash with x, y).
|
|
10
|
+
#
|
|
11
|
+
# The virtual grid is 12 rows by 24 columns (or 24 columns by 12 rows in portrait mode).
|
|
12
|
+
#
|
|
13
|
+
# @param row [Integer]
|
|
14
|
+
# @param col [Integer]
|
|
15
|
+
# @param width [Integer]
|
|
16
|
+
# @param height [Integer]
|
|
17
|
+
# @return [Hash] returns a Hash with properties x, y, w, h, and center (which contains a Hash with x, y).
|
|
18
|
+
def rect row, col, width, height; end
|
|
19
|
+
|
|
20
|
+
# Function returns an array of primities that can be rendered to the screen to help you place items within the grid.
|
|
21
|
+
#
|
|
22
|
+
# @return [Array] an array of primities that can be rendered to the screen to help you place items within the grid.
|
|
23
|
+
def debug_primitives; end
|
|
24
|
+
|
|
25
|
+
# @return [Boolean] Returns true if orientation is :portrait.
|
|
26
|
+
def portrait?; end
|
|
27
|
+
|
|
28
|
+
# @return [Boolean] Returns true if orientation is :landscape.
|
|
29
|
+
def landscape?; end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
class Numeric
|
|
2
|
+
# converts `self` from seconds to ticks
|
|
3
|
+
# @return [Float]
|
|
4
|
+
def seconds
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# returns `self` clamped to the `[0; 255]` range and converted to an integer
|
|
8
|
+
# @return [Integer]
|
|
9
|
+
def to_byte
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# wrapping clamp
|
|
13
|
+
# examples:
|
|
14
|
+
# ```rb
|
|
15
|
+
# 5.clamp_wrap(2, 4) # => 2
|
|
16
|
+
# 5.clamp_wrap(10, 20) # => 16
|
|
17
|
+
# 123.clamp_wrap(10, 20) # => 13
|
|
18
|
+
# ```
|
|
19
|
+
# @param min [Numeric]
|
|
20
|
+
# @param max [Numeric]
|
|
21
|
+
# @return [Numeric]
|
|
22
|
+
def clamp_wrap(min, max)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# linear interpolation from `self` to `to` at `step`
|
|
26
|
+
# @param to [Numeric] number to lerp to
|
|
27
|
+
# @param step [Numeric] time; often denoted `t`
|
|
28
|
+
# @return [Numeric]
|
|
29
|
+
def lerp(to, step)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# map `self` from one range to another
|
|
33
|
+
# @param r1_begin [Numeric] the beginning of the source range
|
|
34
|
+
# @param r1_end [Numeric] the end of the source range
|
|
35
|
+
# @param r2_begin [Numeric] the beginning of the result range
|
|
36
|
+
# @param r2_end [Numeric] the end of the result range
|
|
37
|
+
# @return [Numeric]
|
|
38
|
+
def remap(r1_begin, r1_end, r2_begin, r2_end)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# calls the block with successive integers up to `self.to_i` (exclusive)
|
|
42
|
+
# shorthand for `self.times.each`
|
|
43
|
+
# @yieldparam i [Integer] successive integers
|
|
44
|
+
# @return [self]
|
|
45
|
+
def each(&blk)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# calls the block with a pair of integers
|
|
49
|
+
# shorthand for `self.times.each_with_index`
|
|
50
|
+
# @yieldparam i [Integer]
|
|
51
|
+
# @yieldparam idx [Integer]
|
|
52
|
+
# @return [self]
|
|
53
|
+
def each_with_index(&blk)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# calls the block with successive integers up to `self.to_i` (exclusive)
|
|
57
|
+
# and constructs an array of the yielded values
|
|
58
|
+
# shorthand for `self.times.map`
|
|
59
|
+
# @yieldparam i [Integer] successive integers
|
|
60
|
+
# @return [Array]
|
|
61
|
+
def map(&blk)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# calls the block with a pair of integers
|
|
65
|
+
# and constructs an array of the yielded values
|
|
66
|
+
# shorthand for `self.times.map_with_index`
|
|
67
|
+
# @yieldparam i [Integer]
|
|
68
|
+
# @yieldparam idx [Integer]
|
|
69
|
+
# @return [Array]
|
|
70
|
+
def map_with_index(&blk)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# calls the block with a pair of integers
|
|
74
|
+
# and constructs an array resulting from the concatenation
|
|
75
|
+
# of the yielded arrays
|
|
76
|
+
# shorthand for `self.times.flat_map`
|
|
77
|
+
# @yieldparam i [Integer]
|
|
78
|
+
# @yieldreturn [Array]
|
|
79
|
+
# @return [Array]
|
|
80
|
+
def flat_map(&blk)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Outputs
|
|
3
|
+
# @return [String, nil] name of the render target or `nil` if top-level
|
|
4
|
+
attr_accessor :target
|
|
5
|
+
|
|
6
|
+
# @return [Integer] width of the outputs instance
|
|
7
|
+
attr_accessor :width
|
|
8
|
+
|
|
9
|
+
# @return [Integer] height of the outputs instance
|
|
10
|
+
attr_accessor :height
|
|
11
|
+
|
|
12
|
+
# @return [Boolean] returns whether the target is transient
|
|
13
|
+
attr_accessor :transient
|
|
14
|
+
|
|
15
|
+
# @return [Hash, Array] either a color hash (color keys default to `230` if not passed, alpha defaults to `255`),
|
|
16
|
+
# or a color array of the format `[r, g, b]` or `[r, g, b, a]`
|
|
17
|
+
attr_accessor :background_color
|
|
18
|
+
|
|
19
|
+
# Whether to clear the render target this frame, before any other operations are added to it.
|
|
20
|
+
#
|
|
21
|
+
# Defaults to True.
|
|
22
|
+
#
|
|
23
|
+
# @return [Boolean]
|
|
24
|
+
attr_accessor :clear_before_render
|
|
25
|
+
|
|
26
|
+
# @return [OutputsArray]
|
|
27
|
+
attr_reader :solids, :sprites, :lines, :labels, :borders, :primitives, :reserved, :debug,
|
|
28
|
+
:static_solids, :static_sprites, :static_lines, :static_labels, :static_borders,
|
|
29
|
+
:static_primitives, :static_reserved, :static_debug, :screenshots
|
|
30
|
+
|
|
31
|
+
# @param name [String, Symbol]
|
|
32
|
+
# @return [Outputs] render target named by `name`
|
|
33
|
+
def render_target(name); end
|
|
34
|
+
|
|
35
|
+
# @param name [String, Symbol]
|
|
36
|
+
# @return [Outputs] render target named by `name`
|
|
37
|
+
def [](name); end
|
|
38
|
+
|
|
39
|
+
# sets `transient` to `true`
|
|
40
|
+
def transient!; end
|
|
41
|
+
|
|
42
|
+
# pushes `obj` into the `primitives` array
|
|
43
|
+
# @param obj [Object]
|
|
44
|
+
# @return [self]
|
|
45
|
+
def <<(obj); end
|
|
46
|
+
|
|
47
|
+
alias w width
|
|
48
|
+
alias w= width=
|
|
49
|
+
alias h height
|
|
50
|
+
alias h= height=
|
|
51
|
+
|
|
52
|
+
# @return [Boolean] returns whether a screenshot can be taken on the current tick
|
|
53
|
+
def can_screenshot?; end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# parent module holding all phantom types used only for typing arguments/return values
|
|
2
|
+
# none of these classes/modules actually exist in the dragonruby runtime
|
|
3
|
+
module Typing
|
|
4
|
+
# phantom type denoting a point-like object
|
|
5
|
+
module Point
|
|
6
|
+
# @return [Integer, Float]
|
|
7
|
+
attr_reader :x, :y
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# phantom type denoting a rect-like object
|
|
11
|
+
module Rect
|
|
12
|
+
# @return [Integer, Float]
|
|
13
|
+
attr_reader :x, :y, :w, :h
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# phantom type for the hash returned by a `GTK::Runtime#get_pixels` call
|
|
17
|
+
# not a subclass of `Hash` because you probably(tm) will not use it as a normal hash
|
|
18
|
+
module PixelsHash
|
|
19
|
+
# @return [Integer]
|
|
20
|
+
attr_reader :w, :h
|
|
21
|
+
|
|
22
|
+
# @return [Array<Integer>]
|
|
23
|
+
attr_reader :pixels
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @!method tick(args)
|
|
2
|
+
# @abstract tick function, override it with your game
|
|
3
|
+
# @param args [GTK::Args]
|
|
4
|
+
# @return [void]
|
|
5
|
+
|
|
6
|
+
# @!method boot(args)
|
|
7
|
+
# @abstract boot function, override for setup that has to happen once, at the very beginning of the dr process
|
|
8
|
+
# @param args [GTK::Args]
|
|
9
|
+
# @return [void]
|
|
10
|
+
|
|
11
|
+
# @!method reset(args)
|
|
12
|
+
# @param args [GTK::Args]
|
|
13
|
+
# @return [void]
|
metadata
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: solargraph-dragonruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Austin Simmons
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: solargraph
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.61.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.61.0
|
|
26
|
+
description: Adds YARD-documented DragonRuby GTK API pins (args, outputs, inputs,
|
|
27
|
+
$gtk, Geometry, ...) to Solargraph so LSP editors get autocomplete, hover and go-to-definition
|
|
28
|
+
in DragonRuby games.
|
|
29
|
+
email:
|
|
30
|
+
- austin_simmons@fastmail.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- CHANGELOG.md
|
|
36
|
+
- CODE_OF_CONDUCT.md
|
|
37
|
+
- LICENSE.txt
|
|
38
|
+
- NOTICE
|
|
39
|
+
- README.md
|
|
40
|
+
- Rakefile
|
|
41
|
+
- lib/solargraph-dragonruby.rb
|
|
42
|
+
- lib/solargraph/dragonruby.rb
|
|
43
|
+
- lib/solargraph/dragonruby/convention.rb
|
|
44
|
+
- lib/solargraph/dragonruby/macro_node.rb
|
|
45
|
+
- lib/solargraph/dragonruby/version.rb
|
|
46
|
+
- sig/solargraph/dragonruby.rbs
|
|
47
|
+
- stubs/extensions/README.md
|
|
48
|
+
- stubs/extensions/args.rb
|
|
49
|
+
- stubs/extensions/array.rb
|
|
50
|
+
- stubs/extensions/attr.rb
|
|
51
|
+
- stubs/extensions/easing.rb
|
|
52
|
+
- stubs/extensions/entity.rb
|
|
53
|
+
- stubs/extensions/geometry.rb
|
|
54
|
+
- stubs/extensions/grid.rb
|
|
55
|
+
- stubs/extensions/inputs.rb
|
|
56
|
+
- stubs/extensions/layout.rb
|
|
57
|
+
- stubs/extensions/log.rb
|
|
58
|
+
- stubs/extensions/main.rb
|
|
59
|
+
- stubs/extensions/numeric.rb
|
|
60
|
+
- stubs/extensions/outputs.rb
|
|
61
|
+
- stubs/extensions/runtime.rb
|
|
62
|
+
- stubs/extensions/string.rb
|
|
63
|
+
- stubs/extensions/typing.rb
|
|
64
|
+
- stubs/extensions/zlib.rb
|
|
65
|
+
- stubs/upstream/LICENSE.txt
|
|
66
|
+
- stubs/upstream/UPSTREAM
|
|
67
|
+
- stubs/upstream/args.rb
|
|
68
|
+
- stubs/upstream/constants.rb
|
|
69
|
+
- stubs/upstream/controller.rb
|
|
70
|
+
- stubs/upstream/easing.rb
|
|
71
|
+
- stubs/upstream/geometry.rb
|
|
72
|
+
- stubs/upstream/globals.rb
|
|
73
|
+
- stubs/upstream/gtk.rb
|
|
74
|
+
- stubs/upstream/inputs.rb
|
|
75
|
+
- stubs/upstream/kernel.rb
|
|
76
|
+
- stubs/upstream/keyboard.rb
|
|
77
|
+
- stubs/upstream/layout.rb
|
|
78
|
+
- stubs/upstream/numeric.rb
|
|
79
|
+
- stubs/upstream/outputs.rb
|
|
80
|
+
- stubs/upstream/outputs_array.rb
|
|
81
|
+
- stubs/upstream/phantom_types.rb
|
|
82
|
+
- stubs/upstream/toplevel.rb
|
|
83
|
+
homepage: https://github.com/asimmons91/solargraph-dragonruby
|
|
84
|
+
licenses:
|
|
85
|
+
- MIT
|
|
86
|
+
metadata:
|
|
87
|
+
source_code_uri: https://github.com/asimmons91/solargraph-dragonruby
|
|
88
|
+
changelog_uri: https://github.com/asimmons91/solargraph-dragonruby/blob/main/CHANGELOG.md
|
|
89
|
+
rubygems_mfa_required: 'true'
|
|
90
|
+
rdoc_options: []
|
|
91
|
+
require_paths:
|
|
92
|
+
- lib
|
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: 3.2.0
|
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
requirements: []
|
|
104
|
+
rubygems_version: 4.0.20
|
|
105
|
+
specification_version: 4
|
|
106
|
+
summary: Solargraph plugin providing DragonRuby Game Toolkit API completion
|
|
107
|
+
test_files: []
|