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,24 @@
|
|
|
1
|
+
# Compresses and uncompresses strings.
|
|
2
|
+
module Zlib
|
|
3
|
+
class << self
|
|
4
|
+
# @param string [String]
|
|
5
|
+
# @return [String] compressed data
|
|
6
|
+
def compress string; end
|
|
7
|
+
|
|
8
|
+
# Same as #compress.
|
|
9
|
+
#
|
|
10
|
+
# @param string [String]
|
|
11
|
+
# @return [String]
|
|
12
|
+
def deflate string; end
|
|
13
|
+
|
|
14
|
+
# @param string [String] data returned by #compress
|
|
15
|
+
# @return [String] the original string
|
|
16
|
+
def uncompress string; end
|
|
17
|
+
|
|
18
|
+
# Same as #uncompress.
|
|
19
|
+
#
|
|
20
|
+
# @param string [String]
|
|
21
|
+
# @return [String]
|
|
22
|
+
def inflate string; end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Owen Butler
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Args
|
|
3
|
+
# @return [GTK::Inputs]
|
|
4
|
+
attr_reader :inputs
|
|
5
|
+
|
|
6
|
+
# @return [GTK::Outputs]
|
|
7
|
+
attr_reader :outputs
|
|
8
|
+
|
|
9
|
+
# Hash that contains audio sources that are playing.
|
|
10
|
+
#
|
|
11
|
+
# Sounds that don’t specify looping: true will be removed automatically from the hash after the playback ends. Looping sounds or sounds that should stop early must be removed manually.
|
|
12
|
+
#
|
|
13
|
+
# When you assign a hash to an audio output, a :length key will be added to the hash on the following tick. This will tell you the duration of the audio file in seconds (float).
|
|
14
|
+
#
|
|
15
|
+
# ## volume
|
|
16
|
+
#
|
|
17
|
+
# You can globally control the volume for all audio using args.audio.volume.
|
|
18
|
+
#
|
|
19
|
+
# ## One time sounds
|
|
20
|
+
# ```
|
|
21
|
+
# args.audio[:coin] = { input: "sounds/coin.wav" }
|
|
22
|
+
# ```
|
|
23
|
+
# ## Looping sounds
|
|
24
|
+
# ```
|
|
25
|
+
# args.audio[:bg_music] = { input: "sounds/bg-music.ogg", looping: true }
|
|
26
|
+
# ```
|
|
27
|
+
#
|
|
28
|
+
# see : [additional audio properties](https://docs.dragonruby.org/#/api/audio?id=setting-additional-audio-properties)
|
|
29
|
+
#
|
|
30
|
+
# @return [Hash]
|
|
31
|
+
attr_reader :audio
|
|
32
|
+
|
|
33
|
+
# @return [Module<GTK::Easing>]
|
|
34
|
+
attr_reader :easing
|
|
35
|
+
|
|
36
|
+
# @return [Module<GTK::Layout>]
|
|
37
|
+
attr_reader :layout
|
|
38
|
+
|
|
39
|
+
# @return [Module<GTK::Geometry>]
|
|
40
|
+
attr_reader :geometry
|
|
41
|
+
|
|
42
|
+
# Hash containing metadata pulled from the files under the ./metadata directory.
|
|
43
|
+
#
|
|
44
|
+
# Each CVar has the following properties `value, name, description, type, locked`.
|
|
45
|
+
#
|
|
46
|
+
# example:
|
|
47
|
+
#
|
|
48
|
+
# ```
|
|
49
|
+
# def tick args
|
|
50
|
+
# args.outputs.labels << {
|
|
51
|
+
# x: 640,
|
|
52
|
+
# y: 360,
|
|
53
|
+
# text: args.cvars["game_metadata.version"].value.to_s
|
|
54
|
+
# }
|
|
55
|
+
# end
|
|
56
|
+
# ```
|
|
57
|
+
#
|
|
58
|
+
# @return [Hash] Hash containing metadata pulled from the files under the ./metadata directory.
|
|
59
|
+
attr_reader :cvars
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Controller
|
|
3
|
+
# @return [Boolean] Returns true if a controller is connected. If this value is false, controller properties will not be nil, but return 0 for directional based properties and false button state properties.
|
|
4
|
+
attr_reader :connected
|
|
5
|
+
|
|
6
|
+
# @return [String] String value representing the controller’s name.
|
|
7
|
+
attr_reader :name
|
|
8
|
+
|
|
9
|
+
# @return [Boolean] Returns true if any of the controller’s buttons were used.
|
|
10
|
+
attr_reader :active
|
|
11
|
+
|
|
12
|
+
# @return [Boolean] Returns true if up is pressed or held on the directional or left analog.
|
|
13
|
+
attr_reader :up
|
|
14
|
+
|
|
15
|
+
# @return [Boolean] Returns true if down is pressed or held on the directional or left analog.
|
|
16
|
+
attr_reader :down
|
|
17
|
+
|
|
18
|
+
# @return [Boolean] Returns true if left is pressed or held on the directional or left analog.
|
|
19
|
+
attr_reader :left
|
|
20
|
+
|
|
21
|
+
# @return [Boolean] Returns true if right is pressed or held on the directional or left analog.
|
|
22
|
+
attr_reader :right
|
|
23
|
+
|
|
24
|
+
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #left, #right
|
|
25
|
+
attr_reader :left_right
|
|
26
|
+
|
|
27
|
+
# @return [Integer] Returns -1 (left), 0 (neutral), or +1 (right) depending on results of #up, #down
|
|
28
|
+
attr_reader :up_down
|
|
29
|
+
|
|
30
|
+
# @return [Integer] Returns the raw integer value for the analog’s horizontal movement (-32,767 to +32,767).
|
|
31
|
+
attr_reader :left_analog_x_raw, :right_analog_x_raw
|
|
32
|
+
|
|
33
|
+
# @return [Integer] Returns the raw integer value for the analog’s vertical movement (-32,767 to +32,767).
|
|
34
|
+
attr_reader :left_analog_y_raw, :right_analog_y_raw
|
|
35
|
+
|
|
36
|
+
# @return [Float] Returns a number between -1 and 1 which represents the percentage the analog is moved horizontally as a ratio of the maximum horizontal movement.
|
|
37
|
+
attr_reader :left_analog_x_perc, :right_analog_x_perc
|
|
38
|
+
|
|
39
|
+
# @return [Float] Returns a number between -1 and 1 which represents the percentage the analog is moved vertically as a ratio of the maximum vertical movement.
|
|
40
|
+
attr_reader :left_analog_y_perc, :right_analog_y_perc
|
|
41
|
+
|
|
42
|
+
# @return [Boolean] Returns true if up is pressed or held on the dpad.
|
|
43
|
+
attr_reader :dpad_up, :directional_up
|
|
44
|
+
|
|
45
|
+
# @return [Boolean] Returns true if down is pressed or held on the dpad.
|
|
46
|
+
attr_reader :dpad_down, :directional_down
|
|
47
|
+
|
|
48
|
+
# @return [Boolean] Returns true if left is pressed or held on the dpad.
|
|
49
|
+
attr_reader :dpad_left, :directional_left
|
|
50
|
+
|
|
51
|
+
# @return [Boolean] Returns true if right is pressed or held on the dpad.
|
|
52
|
+
attr_reader :dpad_right, :directional_right
|
|
53
|
+
|
|
54
|
+
# @return [Boolean] Returns true if the specific button is pressed or held.
|
|
55
|
+
attr_reader :a, :b, :x, :y, :l1, :r1, :l2, :r2, :l3, :r3, :start, :select
|
|
56
|
+
|
|
57
|
+
# @ return [Object] Returns a collection of Symbols that represent all keys that are in the pressed or held state.
|
|
58
|
+
attr_reader :truthy_keys
|
|
59
|
+
|
|
60
|
+
# @return [Boolean] Returns true if the specific button was pressed on this frame.
|
|
61
|
+
# button can be one of: (a|b|x|y|l1|r1|l2|r2|l3|r3|start|select)
|
|
62
|
+
# result will only be true on the frame it was pressed.
|
|
63
|
+
attr_reader :key_down
|
|
64
|
+
|
|
65
|
+
# @return [Boolean] Returns true if the specific button is being held.
|
|
66
|
+
# button can be one of: (a|b|x|y|l1|r1|l2|r2|l3|r3|start|select)
|
|
67
|
+
# result will be true for all frames after key_down (until released)
|
|
68
|
+
attr_reader :key_held
|
|
69
|
+
|
|
70
|
+
# @return [Boolean] Returns true if the specific button was pressed on this frame.
|
|
71
|
+
# button can be one of: (a|b|x|y|l1|r1|l2|r2|l3|r3|start|select)
|
|
72
|
+
# result will only be true on the frame it was pressed.
|
|
73
|
+
attr_reader :key_up
|
|
74
|
+
|
|
75
|
+
# Returns true if the Left Analog Stick is tilted.
|
|
76
|
+
# The threshold_raw and threshold_perc are optional parameters that can be used to set the minimum threshold for the analog stick to be considered active.
|
|
77
|
+
# The threshold_raw is a number between 0 and 32,767, and the threshold_perc is a number between 0 and 1.
|
|
78
|
+
#
|
|
79
|
+
# @return [Boolean] Returns true if the Left Analog Stick is tilted.
|
|
80
|
+
def left_analog_active? threshold_raw, threshold_perc; end
|
|
81
|
+
|
|
82
|
+
# Returns true if the Right Analog Stick is tilted.
|
|
83
|
+
# The threshold_raw and threshold_perc are optional parameters that can be used to set the minimum threshold for the analog stick to be considered active.
|
|
84
|
+
# The threshold_raw is a number between 0 and 32,767, and the threshold_perc is a number between 0 and 1.
|
|
85
|
+
#
|
|
86
|
+
# @return [Boolean] Returns true if the Right Analog Stick is tilted.
|
|
87
|
+
def right_analog_active? threshold_raw, threshold_perc; end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
# A set of functions that allow you to determine the current progression of an easing function.
|
|
3
|
+
module Easing
|
|
4
|
+
class << self
|
|
5
|
+
# Given a start, current, duration, and a multiple bezier values, this function returns a number between 0 and 1 that represents the progress of an easing function.
|
|
6
|
+
#
|
|
7
|
+
# @param start_tick [Integer]
|
|
8
|
+
# @param current_tick [Integer]
|
|
9
|
+
# @param duration [Integer] duration in ticks
|
|
10
|
+
# @param spline [Array] multiple bezier values
|
|
11
|
+
# @return [Float] returns a number between 0 and 1 that represents the progress of an easing function.
|
|
12
|
+
def ease_spline start_tick, current_tick, duration, spline; end
|
|
13
|
+
|
|
14
|
+
# Given a start, current, duration, and easing definitions. This function returns a number between 0 and 1 that represents the progress of an easing function.
|
|
15
|
+
#
|
|
16
|
+
# @param start_tick [Integer]
|
|
17
|
+
# @param current_tick [Integer]
|
|
18
|
+
# @param duration [Integer] duration in ticks
|
|
19
|
+
# @param definitions [Object] easing definitions
|
|
20
|
+
# @return [Float] returns a number between 0 and 1 that represents the progress of an easing function.
|
|
21
|
+
def ease start_tick, current_tick, duration, definitions; end
|
|
22
|
+
|
|
23
|
+
# smooth_start
|
|
24
|
+
#
|
|
25
|
+
# @param :initial [Float] starting value of the easing function (defaults to 0.0).
|
|
26
|
+
# @param :final [Float] ending value of the easing function (defaults to 1.0).
|
|
27
|
+
# @param :perc [Float] current easing percentage (a value over 1.0 will result in a higher final value).
|
|
28
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
29
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
30
|
+
def smooth_start initial, final, perc, power; end
|
|
31
|
+
|
|
32
|
+
# smooth_start
|
|
33
|
+
#
|
|
34
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
35
|
+
# @param :end_at [Integer] ending value of the easing function.
|
|
36
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
37
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
38
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
39
|
+
def smooth_start start_at, end_at, tick_count, power; end
|
|
40
|
+
|
|
41
|
+
# smooth_start
|
|
42
|
+
#
|
|
43
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
44
|
+
# @param :duration [Integer] used to compute end_at value.
|
|
45
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
46
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
47
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
48
|
+
def smooth_start start_at, duration, tick_count, power; end
|
|
49
|
+
|
|
50
|
+
# smooth_stop
|
|
51
|
+
#
|
|
52
|
+
# @param :initial [Float] starting value of the easing function (defaults to 0.0).
|
|
53
|
+
# @param :final [Float] ending value of the easing function (defaults to 1.0).
|
|
54
|
+
# @param :perc [Float] current easing percentage (a value over 1.0 will result in a higher final value).
|
|
55
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
56
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
57
|
+
def smooth_stop initial, final, perc, power; end
|
|
58
|
+
|
|
59
|
+
# smooth_stop
|
|
60
|
+
#
|
|
61
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
62
|
+
# @param :end_at [Integer] ending value of the easing function.
|
|
63
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
64
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
65
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
66
|
+
def smooth_stop start_at, end_at, tick_count, power; end
|
|
67
|
+
|
|
68
|
+
# smooth_stop
|
|
69
|
+
#
|
|
70
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
71
|
+
# @param :duration [Integer] used to compute end_at value.
|
|
72
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
73
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
74
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
75
|
+
def smooth_stop start_at, duration, tick_count, power; end
|
|
76
|
+
|
|
77
|
+
# smooth_step
|
|
78
|
+
#
|
|
79
|
+
# @param :initial [Float] starting value of the easing function (defaults to 0.0).
|
|
80
|
+
# @param :final [Float] ending value of the easing function (defaults to 1.0).
|
|
81
|
+
# @param :perc [Float] current easing percentage (a value over 1.0 will result in a higher final value).
|
|
82
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
83
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
84
|
+
def smooth_step initial, final, perc, power; end
|
|
85
|
+
|
|
86
|
+
# smooth_step
|
|
87
|
+
#
|
|
88
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
89
|
+
# @param :end_at [Integer] ending value of the easing function.
|
|
90
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
91
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
92
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
93
|
+
def smooth_step start_at, end_at, tick_count, power; end
|
|
94
|
+
|
|
95
|
+
# smooth_step
|
|
96
|
+
#
|
|
97
|
+
# @param :start_at [Integer] starting tick_count to begin the easing function .
|
|
98
|
+
# @param :duration [Integer] used to compute end_at value.
|
|
99
|
+
# @param :tick_count [Integer] current tick_count (defaults to Kernel.tick_count)
|
|
100
|
+
# @param :power [float] 1 for linear, 2 for quadratic, 3 for cube, etc (defaults to 1.0).
|
|
101
|
+
# @return [Float] value between 0 and 1 that represents a percentage.
|
|
102
|
+
def smooth_step start_at, duration, tick_count, power; end
|
|
103
|
+
|
|
104
|
+
# Return a mixture of eased values.
|
|
105
|
+
#
|
|
106
|
+
# ```
|
|
107
|
+
# \# a 50/50 mix of smooth_start and smooth_stop gives us a smooth_step
|
|
108
|
+
# y_perc = Easing.mix(smoothed_start, smoothed_stop, 0.5)
|
|
109
|
+
# ```
|
|
110
|
+
#
|
|
111
|
+
# See [More Detailed example](https://docs.dragonruby.org/#/api/easing?id=mix)
|
|
112
|
+
#
|
|
113
|
+
# @param val_1 [Float] first value to mix.
|
|
114
|
+
# @param val_2 [Float] second value to mix.
|
|
115
|
+
# @param perc [Float] mix percentage.
|
|
116
|
+
def mix val_1, val_2, perc; end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|