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,175 @@
|
|
|
1
|
+
module GTK
|
|
2
|
+
class Layout
|
|
3
|
+
class << self
|
|
4
|
+
# @return [Integer] rows in the layout grid (`12` landscape, `24` portrait)
|
|
5
|
+
def row_count; end
|
|
6
|
+
|
|
7
|
+
# @return [Integer] maximum row index
|
|
8
|
+
def row_max_index; end
|
|
9
|
+
|
|
10
|
+
# @return [Integer] columns in the layout grid (`24` landscape, `12` portrait)
|
|
11
|
+
def col_count; end
|
|
12
|
+
|
|
13
|
+
# @return [Integer] maximum column index
|
|
14
|
+
def col_max_index; end
|
|
15
|
+
|
|
16
|
+
# Same as `Layout.rect(..., allscreen: true)`: the returned rect is
|
|
17
|
+
# aligned to `Grid.allscreen_rect` instead of the 16:9 safe area. Useful
|
|
18
|
+
# for layouts in render targets with `hd_letterbox=false`.
|
|
19
|
+
#
|
|
20
|
+
# Pro license (All Screen mode).
|
|
21
|
+
#
|
|
22
|
+
# @param row [Integer, Array(Integer, Integer)]
|
|
23
|
+
# @param col [Integer, Array(Integer, Integer)]
|
|
24
|
+
# @param w [Integer]
|
|
25
|
+
# @param h [Integer]
|
|
26
|
+
# @return [Typing::RectPropsHash] `x`, `y`, `w`, `h`, and `center` (a Hash with `x`, `y`)
|
|
27
|
+
def allscreen_rect row: 0, col: 0, w: 1, h: 1, **opts; end
|
|
28
|
+
|
|
29
|
+
# The rect of a cell span on the virtual grid (12 rows by 24 columns, or
|
|
30
|
+
# 24 by 12 in portrait), within the safe area.
|
|
31
|
+
#
|
|
32
|
+
# @example
|
|
33
|
+
# Layout.rect(row: 1, col: 10, w: 4, h: 2)
|
|
34
|
+
# Layout.rect(row: 0, col: [3, -3]) # columns 3 through the third from the right
|
|
35
|
+
#
|
|
36
|
+
# @param row [Numeric, Array(Integer, Integer)] row, or a `[from, to]` range (`to <= 0` counts from the end)
|
|
37
|
+
# @param col [Numeric, Array(Integer, Integer)] column, or a `[from, to]` range
|
|
38
|
+
# @param w [Numeric] width in cells
|
|
39
|
+
# @param h [Numeric] height in cells
|
|
40
|
+
# @param row_from_bottom [Numeric, nil] row counted from the bottom, instead of `row`
|
|
41
|
+
# @param col_from_right [Numeric, nil] column counted from the right, instead of `col`
|
|
42
|
+
# @param max_width [Numeric, nil]
|
|
43
|
+
# @param max_height [Numeric, nil]
|
|
44
|
+
# @param dx [Numeric] added to `x`
|
|
45
|
+
# @param dy [Numeric] added to `y`
|
|
46
|
+
# @param include_row_gutter [Boolean]
|
|
47
|
+
# @param include_col_gutter [Boolean]
|
|
48
|
+
# @param include_gutter [Boolean] both gutters
|
|
49
|
+
# @param merge [Hash, nil] merged into the result
|
|
50
|
+
# @param origin [Symbol]
|
|
51
|
+
# @param safe_area [Boolean]
|
|
52
|
+
# @param allscreen [Boolean] align to `Grid.allscreen_rect` (Pro license, All Screen mode)
|
|
53
|
+
# @return [Typing::RectPropsHash] `x`, `y`, `w`, `h`, and `center` (a Hash with `x`, `y`)
|
|
54
|
+
def rect row: 0, col: 0, w: 1, h: 1, row_from_bottom: nil, col_from_right: nil, max_width: nil, max_height: nil, dx: 0, dy: 0, include_row_gutter: false, include_col_gutter: false, include_gutter: false, merge: nil, origin: :top_left, safe_area: true, allscreen: false; end
|
|
55
|
+
|
|
56
|
+
# Lays out `items` one after another, wrapping at the edge of the grid.
|
|
57
|
+
# Each result is the item's rect merged with `item:` and `layout:`.
|
|
58
|
+
# An item may carry its own `rect_args` (`w`, `h`, gutters).
|
|
59
|
+
#
|
|
60
|
+
# @param items [Array]
|
|
61
|
+
# @param direction [Symbol] `:row` (left to right) or `:col` (top to bottom)
|
|
62
|
+
# @param row [Numeric] starting row
|
|
63
|
+
# @param col [Numeric] starting column
|
|
64
|
+
# @param w [Numeric] width of each item in cells
|
|
65
|
+
# @param h [Numeric] height of each item in cells
|
|
66
|
+
# @param include_row_gutter [Boolean]
|
|
67
|
+
# @param include_col_gutter [Boolean]
|
|
68
|
+
# @return [Array<Typing::RectPropsHash>]
|
|
69
|
+
def rects items, direction: :row, row: 0, col: 0, w: 1, h: 1, include_row_gutter: false, include_col_gutter: false; end
|
|
70
|
+
|
|
71
|
+
# Lays out each Hash in `group:` starting at `row:`/`col:` (or
|
|
72
|
+
# `row_from_bottom:`/`col_from_right:`), stepping by `drow:`/`dcol:`.
|
|
73
|
+
# Each result is the rect merged with the item (labels honor
|
|
74
|
+
# `alignment_enum`).
|
|
75
|
+
#
|
|
76
|
+
# @example
|
|
77
|
+
# Layout.rect_group(row: 0, col: 0, drow: 0.5, group: [{ text: "a" }, { text: "b" }])
|
|
78
|
+
#
|
|
79
|
+
# @param group [Array<Hash>] items to lay out; each may have its own `layout:` rect options
|
|
80
|
+
# @param row [Numeric, nil] starting row
|
|
81
|
+
# @param col [Numeric, nil] starting column
|
|
82
|
+
# @param row_from_bottom [Numeric, nil] starting row counted from the bottom
|
|
83
|
+
# @param col_from_right [Numeric, nil] starting column counted from the right
|
|
84
|
+
# @param drow [Numeric] rows to move for each item
|
|
85
|
+
# @param dcol [Numeric] columns to move for each item
|
|
86
|
+
# @param w [Numeric] width of each item in cells
|
|
87
|
+
# @param h [Numeric] height of each item in cells
|
|
88
|
+
# @param merge [Hash, nil] merged into every result
|
|
89
|
+
# @param row_offset [Hash, nil] `count:` (and `h:`) of items to center vertically
|
|
90
|
+
# @param col_offset [Hash, nil] `count:` (and `w:`) of items to center horizontally
|
|
91
|
+
# @return [Array<Typing::RectPropsHash>]
|
|
92
|
+
def rect_group group:, row: nil, col: nil, row_from_bottom: nil, col_from_right: nil, drow: 0, dcol: 0, w: 0, h: 0, merge: nil, row_offset: nil, col_offset: nil; end
|
|
93
|
+
|
|
94
|
+
# A point inside a cell. `row_anchor:`/`col_anchor:` (`0.0` to `1.0`)
|
|
95
|
+
# pick where in the cell; the default is the cell's bottom left.
|
|
96
|
+
#
|
|
97
|
+
# @example
|
|
98
|
+
# Layout.point(row: 7, col: 5.5, row_anchor: 0.5, col_anchor: 0.5)
|
|
99
|
+
#
|
|
100
|
+
# @param row [Numeric]
|
|
101
|
+
# @param col [Numeric]
|
|
102
|
+
# @param row_anchor [Float, nil] `0.0` (bottom) to `1.0` (top) of the cell
|
|
103
|
+
# @param col_anchor [Float, nil] `0.0` (left) to `1.0` (right) of the cell
|
|
104
|
+
# @param rect_options [Hash] other #rect options
|
|
105
|
+
# @return [Typing::RectPropsHash]
|
|
106
|
+
def point row: 0, col: 0, row_anchor: nil, col_anchor: nil, **rect_options; end
|
|
107
|
+
|
|
108
|
+
# @param reference [Typing::Rect, Object] rect to take the size from
|
|
109
|
+
# @param target [Typing::Rect, Object] rect to center on
|
|
110
|
+
# @return [Typing::RectHash] a rect the size of `reference` centered on `target`
|
|
111
|
+
def rect_center reference, target; end
|
|
112
|
+
|
|
113
|
+
# @param n [Numeric]
|
|
114
|
+
# @return [Numeric] width of `n` columns
|
|
115
|
+
def w n; end
|
|
116
|
+
|
|
117
|
+
# @param n [Numeric]
|
|
118
|
+
# @return [Numeric] height of `n` rows
|
|
119
|
+
def h n; end
|
|
120
|
+
|
|
121
|
+
# @return [Numeric] space between cells
|
|
122
|
+
def gutter; end
|
|
123
|
+
|
|
124
|
+
# @return [Numeric] size of a cell (cells are square)
|
|
125
|
+
def cell_size; end
|
|
126
|
+
|
|
127
|
+
# @return [Numeric] same as #cell_size
|
|
128
|
+
def cell_width; end
|
|
129
|
+
|
|
130
|
+
# @return [Numeric] same as #cell_size
|
|
131
|
+
def cell_height; end
|
|
132
|
+
|
|
133
|
+
# @return [Typing::RectHash] `x`, `y`, `w`, `h` of the area inside the outer gutters
|
|
134
|
+
def control_rect; end
|
|
135
|
+
|
|
136
|
+
# @return [Typing::RectHash] `x`, `y`, `w`, `h` of the safe area
|
|
137
|
+
def safe_rect; end
|
|
138
|
+
|
|
139
|
+
# @return [Typing::RectHash] `x`, `y`, `w`, `h` of the logical canvas
|
|
140
|
+
def logical_rect; end
|
|
141
|
+
|
|
142
|
+
# @return [Symbol] `:landscape` or `:portrait`
|
|
143
|
+
def orientation; end
|
|
144
|
+
|
|
145
|
+
# @return [Numeric] font size in points that fills a cell's height
|
|
146
|
+
def font_size_cell; end
|
|
147
|
+
|
|
148
|
+
# @return [Numeric] same as #font_size_cell
|
|
149
|
+
def font_size_xl; end
|
|
150
|
+
|
|
151
|
+
# @return [Numeric] 80% of #font_size_cell
|
|
152
|
+
def font_size_lg; end
|
|
153
|
+
|
|
154
|
+
# @return [Numeric] 70% of #font_size_cell
|
|
155
|
+
def font_size_med; end
|
|
156
|
+
|
|
157
|
+
# @return [Numeric] same as #font_size_med
|
|
158
|
+
def font_size; end
|
|
159
|
+
|
|
160
|
+
# @return [Numeric] 60% of #font_size_cell
|
|
161
|
+
def font_size_sm; end
|
|
162
|
+
|
|
163
|
+
# @return [Numeric] 50% of #font_size_cell
|
|
164
|
+
def font_size_xs; end
|
|
165
|
+
|
|
166
|
+
# @param px [Numeric]
|
|
167
|
+
# @return [Integer] `px` in points
|
|
168
|
+
def font_px_to_pt px; end
|
|
169
|
+
|
|
170
|
+
# @param pt [Numeric]
|
|
171
|
+
# @return [Numeric] `pt` in pixels
|
|
172
|
+
def font_pt_to_px pt; end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Logging functions available everywhere. Output goes to the console and
|
|
2
|
+
# the log file.
|
|
3
|
+
class Object
|
|
4
|
+
# Logs `args`, like `puts`.
|
|
5
|
+
#
|
|
6
|
+
# @return [void]
|
|
7
|
+
def log *args; end
|
|
8
|
+
|
|
9
|
+
# Logs `args` without a trailing newline.
|
|
10
|
+
#
|
|
11
|
+
# @return [void]
|
|
12
|
+
def log_print *args; end
|
|
13
|
+
|
|
14
|
+
# Logs `args` as an important, highlighted message.
|
|
15
|
+
#
|
|
16
|
+
# @return [void]
|
|
17
|
+
def log_important *args; end
|
|
18
|
+
|
|
19
|
+
# Logs `args` at the info level.
|
|
20
|
+
#
|
|
21
|
+
# @return [void]
|
|
22
|
+
def log_info *args; end
|
|
23
|
+
|
|
24
|
+
# Logs `args` at the error level.
|
|
25
|
+
#
|
|
26
|
+
# @return [void]
|
|
27
|
+
def log_error *args; end
|
|
28
|
+
|
|
29
|
+
# Logs `str` at the spam level.
|
|
30
|
+
#
|
|
31
|
+
# @param str [String]
|
|
32
|
+
# @param subsystem [String, nil]
|
|
33
|
+
# @return [void]
|
|
34
|
+
def log_spam str, subsystem = nil; end
|
|
35
|
+
|
|
36
|
+
# Logs `str` at the debug level.
|
|
37
|
+
#
|
|
38
|
+
# @param str [String]
|
|
39
|
+
# @param subsystem [String, nil]
|
|
40
|
+
# @return [void]
|
|
41
|
+
def log_debug str, subsystem = nil; end
|
|
42
|
+
|
|
43
|
+
# Logs `str` at the warn level.
|
|
44
|
+
#
|
|
45
|
+
# @param str [String]
|
|
46
|
+
# @param subsystem [String, nil]
|
|
47
|
+
# @return [void]
|
|
48
|
+
def log_warn str, subsystem = nil; end
|
|
49
|
+
|
|
50
|
+
# Logs `str` at the unfiltered level.
|
|
51
|
+
#
|
|
52
|
+
# @param str [String]
|
|
53
|
+
# @param subsystem [String, nil]
|
|
54
|
+
# @return [void]
|
|
55
|
+
def log_unfiltered str, subsystem = nil; end
|
|
56
|
+
|
|
57
|
+
# Logs `message` only the first time it's called with these `ids`.
|
|
58
|
+
#
|
|
59
|
+
# @example
|
|
60
|
+
# log_once :low_health, "health is low"
|
|
61
|
+
#
|
|
62
|
+
# @param ids [Array<Symbol, String>]
|
|
63
|
+
# @param message [String]
|
|
64
|
+
# @param include_caller [Boolean] also log the backtrace
|
|
65
|
+
# @param raise_if [Boolean] raise `message` instead of logging it
|
|
66
|
+
# @return [void]
|
|
67
|
+
def log_once *ids, message, include_caller: false, raise_if: false; end
|
|
68
|
+
|
|
69
|
+
# Like #log_once, as an important message.
|
|
70
|
+
#
|
|
71
|
+
# @return [void]
|
|
72
|
+
def log_once_important *ids, message, include_caller: false; end
|
|
73
|
+
|
|
74
|
+
# Like #log_once, at the info level.
|
|
75
|
+
#
|
|
76
|
+
# @return [void]
|
|
77
|
+
def log_once_info *ids, message, include_caller: false; end
|
|
78
|
+
|
|
79
|
+
# Logs `args` in black.
|
|
80
|
+
#
|
|
81
|
+
# @return [void]
|
|
82
|
+
def log_black *args; end
|
|
83
|
+
|
|
84
|
+
# Logs `args` in red.
|
|
85
|
+
#
|
|
86
|
+
# @return [void]
|
|
87
|
+
def log_red *args; end
|
|
88
|
+
|
|
89
|
+
# Logs `args` in green.
|
|
90
|
+
#
|
|
91
|
+
# @return [void]
|
|
92
|
+
def log_green *args; end
|
|
93
|
+
|
|
94
|
+
# Logs `args` in yellow.
|
|
95
|
+
#
|
|
96
|
+
# @return [void]
|
|
97
|
+
def log_yellow *args; end
|
|
98
|
+
|
|
99
|
+
# Logs `args` in blue.
|
|
100
|
+
#
|
|
101
|
+
# @return [void]
|
|
102
|
+
def log_blue *args; end
|
|
103
|
+
|
|
104
|
+
# Logs `args` in magenta.
|
|
105
|
+
#
|
|
106
|
+
# @return [void]
|
|
107
|
+
def log_magenta *args; end
|
|
108
|
+
|
|
109
|
+
# Logs `args` in cyan.
|
|
110
|
+
#
|
|
111
|
+
# @return [void]
|
|
112
|
+
def log_cyan *args; end
|
|
113
|
+
|
|
114
|
+
# Logs `args` in white.
|
|
115
|
+
#
|
|
116
|
+
# @return [void]
|
|
117
|
+
def log_white *args; end
|
|
118
|
+
|
|
119
|
+
# Logs `args` in bright black.
|
|
120
|
+
#
|
|
121
|
+
# @return [void]
|
|
122
|
+
def log_bright_black *args; end
|
|
123
|
+
|
|
124
|
+
# Logs `args` in bright red.
|
|
125
|
+
#
|
|
126
|
+
# @return [void]
|
|
127
|
+
def log_bright_red *args; end
|
|
128
|
+
|
|
129
|
+
# Logs `args` in bright green.
|
|
130
|
+
#
|
|
131
|
+
# @return [void]
|
|
132
|
+
def log_bright_green *args; end
|
|
133
|
+
|
|
134
|
+
# Logs `args` in bright yellow.
|
|
135
|
+
#
|
|
136
|
+
# @return [void]
|
|
137
|
+
def log_bright_yellow *args; end
|
|
138
|
+
|
|
139
|
+
# Logs `args` in bright blue.
|
|
140
|
+
#
|
|
141
|
+
# @return [void]
|
|
142
|
+
def log_bright_blue *args; end
|
|
143
|
+
|
|
144
|
+
# Logs `args` in bright magenta.
|
|
145
|
+
#
|
|
146
|
+
# @return [void]
|
|
147
|
+
def log_bright_magenta *args; end
|
|
148
|
+
|
|
149
|
+
# Logs `args` in bright cyan.
|
|
150
|
+
#
|
|
151
|
+
# @return [void]
|
|
152
|
+
def log_bright_cyan *args; end
|
|
153
|
+
|
|
154
|
+
# Logs `args` in bright white.
|
|
155
|
+
#
|
|
156
|
+
# @return [void]
|
|
157
|
+
def log_bright_white *args; end
|
|
158
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# The recommended entry point for a game (see docs/api/runtime.md, "Main").
|
|
2
|
+
# Functions defined in `Main` can call `args`, `inputs`, `outputs`, `state`,
|
|
3
|
+
# `events` and `audio` directly, and the hooks don't need to take `args`.
|
|
4
|
+
#
|
|
5
|
+
# Defining `Main#tick` disables OpenEntity and Array primitives, so `state`
|
|
6
|
+
# is a plain Hash (dot access like `state.score` still works).
|
|
7
|
+
module Main
|
|
8
|
+
# Same object passed to top-level `tick args`.
|
|
9
|
+
# @return [GTK::Args]
|
|
10
|
+
attr_accessor :args
|
|
11
|
+
|
|
12
|
+
# Same as `args.inputs`.
|
|
13
|
+
# @return [GTK::Inputs]
|
|
14
|
+
def inputs; end
|
|
15
|
+
|
|
16
|
+
# Same as `args.outputs`.
|
|
17
|
+
# @return [GTK::Outputs]
|
|
18
|
+
def outputs; end
|
|
19
|
+
|
|
20
|
+
# Same as `args.state`. A plain Hash in `Main` (OpenEntity is disabled),
|
|
21
|
+
# retained across `tick` invocations and cleared by `DR.reset`.
|
|
22
|
+
# @return [Hash]
|
|
23
|
+
def state; end
|
|
24
|
+
|
|
25
|
+
# Same as `args.events`.
|
|
26
|
+
# @return [GTK::Events]
|
|
27
|
+
def events; end
|
|
28
|
+
|
|
29
|
+
# Same as `args.audio`.
|
|
30
|
+
# @return [AudioHash]
|
|
31
|
+
def audio; end
|
|
32
|
+
|
|
33
|
+
# Called once, at the very beginning of the process, for setup.
|
|
34
|
+
# @param args [GTK::Args]
|
|
35
|
+
# @return [void]
|
|
36
|
+
def boot args = nil; end
|
|
37
|
+
|
|
38
|
+
# Called before `tick` when `Kernel.tick_count == 0`. Only available in `Main`.
|
|
39
|
+
# @param args [GTK::Args]
|
|
40
|
+
# @return [void]
|
|
41
|
+
def start args = nil; end
|
|
42
|
+
|
|
43
|
+
# Called every frame (60 times a second). Takes precedence over a
|
|
44
|
+
# top-level `tick`.
|
|
45
|
+
# @param args [GTK::Args]
|
|
46
|
+
# @return [void]
|
|
47
|
+
def tick args = nil; end
|
|
48
|
+
|
|
49
|
+
# Called when `DR.reset` is invoked, before the reset happens.
|
|
50
|
+
# @param args [GTK::Args]
|
|
51
|
+
# @return [void]
|
|
52
|
+
def reset args = nil; end
|
|
53
|
+
|
|
54
|
+
# Called after DragonRuby's internal reset completes (see `reset`).
|
|
55
|
+
# @param args [GTK::Args]
|
|
56
|
+
# @return [void]
|
|
57
|
+
def did_reset args = nil; end
|
|
58
|
+
|
|
59
|
+
# Called before the game exits, and as part of `DR.reboot`.
|
|
60
|
+
# @param args [GTK::Args]
|
|
61
|
+
# @return [void]
|
|
62
|
+
def shutdown args = nil; end
|
|
63
|
+
end
|