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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +56 -0
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/LICENSE.txt +21 -0
  5. data/NOTICE +8 -0
  6. data/README.md +185 -0
  7. data/Rakefile +13 -0
  8. data/lib/solargraph/dragonruby/convention.rb +43 -0
  9. data/lib/solargraph/dragonruby/macro_node.rb +44 -0
  10. data/lib/solargraph/dragonruby/version.rb +7 -0
  11. data/lib/solargraph/dragonruby.rb +15 -0
  12. data/lib/solargraph-dragonruby.rb +5 -0
  13. data/sig/solargraph/dragonruby.rbs +19 -0
  14. data/stubs/extensions/README.md +20 -0
  15. data/stubs/extensions/args.rb +91 -0
  16. data/stubs/extensions/array.rb +25 -0
  17. data/stubs/extensions/attr.rb +249 -0
  18. data/stubs/extensions/easing.rb +90 -0
  19. data/stubs/extensions/entity.rb +63 -0
  20. data/stubs/extensions/geometry.rb +528 -0
  21. data/stubs/extensions/grid.rb +247 -0
  22. data/stubs/extensions/inputs.rb +678 -0
  23. data/stubs/extensions/layout.rb +175 -0
  24. data/stubs/extensions/log.rb +158 -0
  25. data/stubs/extensions/main.rb +63 -0
  26. data/stubs/extensions/numeric.rb +395 -0
  27. data/stubs/extensions/outputs.rb +132 -0
  28. data/stubs/extensions/runtime.rb +436 -0
  29. data/stubs/extensions/string.rb +85 -0
  30. data/stubs/extensions/typing.rb +193 -0
  31. data/stubs/extensions/zlib.rb +24 -0
  32. data/stubs/upstream/LICENSE.txt +21 -0
  33. data/stubs/upstream/UPSTREAM +2 -0
  34. data/stubs/upstream/args.rb +61 -0
  35. data/stubs/upstream/constants.rb +8 -0
  36. data/stubs/upstream/controller.rb +90 -0
  37. data/stubs/upstream/easing.rb +119 -0
  38. data/stubs/upstream/geometry.rb +430 -0
  39. data/stubs/upstream/globals.rb +17 -0
  40. data/stubs/upstream/gtk.rb +476 -0
  41. data/stubs/upstream/inputs.rb +286 -0
  42. data/stubs/upstream/kernel.rb +7 -0
  43. data/stubs/upstream/keyboard.rb +38 -0
  44. data/stubs/upstream/layout.rb +32 -0
  45. data/stubs/upstream/numeric.rb +82 -0
  46. data/stubs/upstream/outputs.rb +55 -0
  47. data/stubs/upstream/outputs_array.rb +4 -0
  48. data/stubs/upstream/phantom_types.rb +25 -0
  49. data/stubs/upstream/toplevel.rb +13 -0
  50. metadata +107 -0
@@ -0,0 +1,436 @@
1
+ # @return [GTK::Runtime] recommended way to access the runtime: `DR.function(...)`
2
+ DR = GTK::Runtime.new
3
+
4
+ # @type [GTK::OpenEntity] same as `args.state`; meant for debugging in the console
5
+ $state = GTK::OpenEntity.new
6
+
7
+ # @!method did_reset(args)
8
+ # called after DragonRuby's internal reset completes (see `reset`)
9
+ # @param args [GTK::Args]
10
+ # @return [void]
11
+
12
+ # @!method shutdown(args)
13
+ # called before the game exits, and as part of `DR.reboot`
14
+ # @param args [GTK::Args]
15
+ # @return [void]
16
+
17
+ class ::Kernel
18
+ class << self
19
+ # current tick of the application since it started; never reset
20
+ # @return [Integer]
21
+ def global_tick_count; end
22
+ end
23
+ end
24
+
25
+ module GTK
26
+ class Runtime
27
+ # Resizes the window. Development/debugging only; not guaranteed to work
28
+ # cross platform.
29
+ #
30
+ # @param w [Integer]
31
+ # @param h [Integer]
32
+ # @return [void]
33
+ def set_window_size w, h; end
34
+
35
+ # Moves the window (origin is top left). Development/debugging only.
36
+ #
37
+ # @param x [Integer]
38
+ # @param y [Integer]
39
+ # @return [void]
40
+ def set_window_position x, y; end
41
+
42
+ # Brings the window to the front and focuses it (does nothing in
43
+ # production). Development/debugging only.
44
+ #
45
+ # @return [void]
46
+ def raise_window; end
47
+
48
+ # Async http GET. The response is filled in over the following ticks.
49
+ #
50
+ # @example
51
+ # args.state.result ||= DR.http_get "https://example.com"
52
+ # puts args.state.result[:response_data] if args.state.result[:complete]
53
+ #
54
+ # @param uri [String]
55
+ # @param headers [Array<String>, nil]
56
+ # @return [Typing::HTTPResponseHash]
57
+ def http_get uri, headers = nil; end
58
+
59
+ # Async http POST of form fields.
60
+ #
61
+ # @param uri [String]
62
+ # @param form_fields [Hash, nil]
63
+ # @param headers [Array<String>, nil] e.g. `["Content-Type: application/x-www-form-urlencoded"]`
64
+ # @return [Typing::HTTPResponseHash]
65
+ def http_post uri, form_fields = nil, headers = nil; end
66
+
67
+ # Async http POST of a raw body.
68
+ #
69
+ # @param uri [String]
70
+ # @param body [String]
71
+ # @param headers [Array<String>, nil]
72
+ # @return [Typing::HTTPResponseHash]
73
+ def http_post_body uri, body, headers = nil; end
74
+
75
+ # @param path [String]
76
+ # @return [Typing::FileStatHash, nil] the file's attributes, or `nil` if it doesn't exist
77
+ def stat_file path; end
78
+
79
+ # @param path [String] a sprite
80
+ # @return [Array(Integer, Integer)] width and height of the sprite
81
+ def calcspritebox path; end
82
+
83
+ # @param path [String] a sprite
84
+ # @return [Typing::RectPropsHash] `x` and `y` (always `0`), `w`, `h`, and `center`
85
+ def get_sprite_rect path; end
86
+
87
+ # Pauses the game: `tick` stops being called until #unpause!.
88
+ #
89
+ # @return [void]
90
+ def pause!; end
91
+
92
+ # @return [void]
93
+ def unpause!; end
94
+
95
+ # @return [Boolean]
96
+ def paused?; end
97
+
98
+ # Converts `state` to a string that #deserialize_state can read back,
99
+ # and writes it to `file` if given.
100
+ #
101
+ # @example
102
+ # DR.serialize_state("game_state.txt", args.state)
103
+ #
104
+ # @overload serialize_state(file, state)
105
+ # @param file [String]
106
+ # @param state [GTK::OpenEntity, Hash]
107
+ # @overload serialize_state(state)
108
+ # @param state [GTK::OpenEntity, Hash]
109
+ # @return [String] the serialized state
110
+ def serialize_state *opts; end
111
+
112
+ # Reads state written by #serialize_state, from a file or a string.
113
+ #
114
+ # @example
115
+ # args.state = DR.deserialize_state("game_state.txt")
116
+ #
117
+ # @param file_or_serialization [String] a file path, or serialized state
118
+ # @return [GTK::OpenEntity, Hash, Array, nil]
119
+ def deserialize_state file_or_serialization; end
120
+
121
+ # Seeds the random number generator (`rand`, `Numeric.rand`, ...).
122
+ #
123
+ # @param value [Integer]
124
+ # @return [void]
125
+ def set_rng value; end
126
+
127
+ # @return [Integer] the current random number seed
128
+ def seed; end
129
+
130
+ # Same as #notify!.
131
+ #
132
+ # @param message [String]
133
+ # @param duration [Integer] ticks to show the notification
134
+ # @return [void]
135
+ def notify message, duration = 300; end
136
+
137
+ # Clears the current notification.
138
+ #
139
+ # @return [void]
140
+ def notify_subdued!; end
141
+
142
+ # Shows `message` as a toast in the console.
143
+ #
144
+ # @param id [Symbol]
145
+ # @param message [String]
146
+ # @return [void]
147
+ def toast id, message; end
148
+
149
+ # Same as #enable_console.
150
+ # @return [void]
151
+ def enable_console!; end
152
+
153
+ # Same as #disable_console.
154
+ # @return [void]
155
+ def disable_console!; end
156
+
157
+ # @return [Array<Hash>] same as #framerate_diagnostics_primitives
158
+ def current_framerate_primitives; end
159
+
160
+ # Stops the warning shown when the framerate drops.
161
+ # @return [void]
162
+ def disable_framerate_warning!; end
163
+
164
+ # @return [void]
165
+ def enable_framerate_warning!; end
166
+
167
+ # @return [Symbol] `:on` or `:off`
168
+ attr_accessor :log_level
169
+
170
+ # Makes `nil` raise on unknown methods instead of returning `nil`
171
+ # (DragonRuby's nil punning). Call outside of `tick`.
172
+ #
173
+ # @return [void]
174
+ def disable_nil_punning!; end
175
+
176
+ # Deletes `path` (relative to the game directory) if it exists.
177
+ #
178
+ # @param path [String]
179
+ # @return [void]
180
+ def delete_file_if_exist path; end
181
+
182
+ # @param uri [String]
183
+ # @param headers [Array<String>, nil]
184
+ # @return [Typing::HTTPResponseHash] an http response that will eventually have a value (see #http_get)
185
+ def http_head uri, headers = nil; end
186
+
187
+ # Uploads the file at `fname`.
188
+ #
189
+ # @param uri [String]
190
+ # @param fname [String]
191
+ # @param headers [Array<String>, nil]
192
+ # @return [Typing::HTTPResponseHash] an http response that will eventually have a value (see #http_get)
193
+ def http_put uri, fname, headers = nil; end
194
+
195
+ # Opens the user's mail client.
196
+ #
197
+ # @param email [String]
198
+ # @param subject [String]
199
+ # @param body [String, nil]
200
+ # @return [void]
201
+ def mailto email:, subject:, body: nil, exception: nil; end
202
+
203
+ # Opens the DragonRuby docs in the browser.
204
+ # @return [void]
205
+ def open_docs; end
206
+
207
+ # Turns on accessibility emulation.
208
+ # @return [void]
209
+ def a11y_enable!; end
210
+
211
+ # @return [void]
212
+ def a11y_disable!; end
213
+
214
+ # @return [Boolean]
215
+ def a11y_enabled?; end
216
+
217
+ # Prefer #platform? for checks.
218
+ #
219
+ # @return [String] e.g. `"Linux"`, `"Windows"`, `"Mac OS X"`, `"Emscripten"`, `"iOS"`, `"Android"`
220
+ attr_reader :platform
221
+
222
+ # @return [Integer] Unix time the game started (also the default random seed)
223
+ attr_reader :started_at
224
+
225
+ # Schedules a block to run at the beginning of the given frame.
226
+ #
227
+ # @example
228
+ # DR.on_tick_count Kernel.tick_count + 300 do |args|
229
+ # DR.notify "five seconds later"
230
+ # end
231
+ #
232
+ # @param tick_count [Integer]
233
+ # @yieldparam args [GTK::Args]
234
+ # @return [void]
235
+ def on_tick_count tick_count, &block; end
236
+
237
+ # Same as #calcstringbox, but returns a Hash.
238
+ #
239
+ # @param text [String]
240
+ # @param size_enum [Integer]
241
+ # @param font [String]
242
+ # @return [Typing::SizeHash] with keys `w` and `h`
243
+ def calcstringbox_h text, size_enum = nil, font = nil; end
244
+
245
+ # Opens a uri in the user's default browser.
246
+ #
247
+ # @param uri [String]
248
+ # @return [void]
249
+ def openurl uri; end
250
+
251
+ # @param name [String]
252
+ # @return [String, nil] value of the environment variable, or `nil` if it doesn't exist
253
+ def getenv name; end
254
+
255
+ # @param name [String]
256
+ # @param value [String]
257
+ # @param overwrite [Boolean] whether to overwrite an existing value
258
+ # @return [void]
259
+ def setenv name, value, overwrite; end
260
+
261
+ # Reads a file from the platform-specific save enclave (`__save_data__`
262
+ # on most platforms). Use for user-specific data.
263
+ #
264
+ # @param file_path [String]
265
+ # @return [String, nil] file contents, or `nil` if the file doesn't exist
266
+ def read_save_data file_path; end
267
+
268
+ # Writes (overwrites) a file in the platform-specific save enclave.
269
+ #
270
+ # @param file_path [String]
271
+ # @param contents [String]
272
+ # @return [void]
273
+ def write_save_data file_path, contents; end
274
+
275
+ # Resets the game and runs a recorded replay against the current code.
276
+ # Put it at the bottom of `main.rb` to re-run the replay on every save.
277
+ #
278
+ # @param replay_file [String] e.g. `"replay.txt"`
279
+ # @param speed [Integer] playback speed multiplier
280
+ # @return [void]
281
+ def reset_and_replay replay_file, speed: 1; end
282
+
283
+ # Compares the performance of lambdas. Pass either `iterations:` (fastest
284
+ # completion wins) or `seconds:` (most iterations wins), plus one lambda
285
+ # per experiment as named arguments.
286
+ #
287
+ # @example
288
+ # DR.benchmark iterations: 1000,
289
+ # using_map: -> { 100.map { |i| i * 2 } },
290
+ # using_times: -> { a = []; 100.times { |i| a << i * 2 } }
291
+ #
292
+ # @param iterations [Integer, nil]
293
+ # @param seconds [Numeric, nil]
294
+ # @param experiments [Hash{Symbol => Proc}]
295
+ # @return [Hash]
296
+ def benchmark iterations: nil, seconds: nil, **experiments; end
297
+
298
+ # Downloads a single-file library from GitHub, either by url or by
299
+ # `user, repo, file`, and saves it under a predefined folder convention.
300
+ #
301
+ # @return [void]
302
+ def download_lib *args; end
303
+
304
+ # Downloads a file from a raw url and saves it to `local_path`.
305
+ #
306
+ # @param url [String]
307
+ # @param local_path [String]
308
+ # @return [void]
309
+ def download_lib_raw url, local_path; end
310
+
311
+ # Prints the caller next to every `puts`; useful for finding rogue
312
+ # `puts` statements. Call at the top of `tick`.
313
+ #
314
+ # @return [void]
315
+ def trace_puts!; end
316
+
317
+ # iOS only.
318
+ #
319
+ # @return [Symbol, nil] `:unknown`, `:nominal`, `:fair`, `:serious`, or `:critical`; `nil` on other platforms
320
+ def current_thermal_state; end
321
+
322
+ # @!group Indie and Pro
323
+
324
+ # Loads a precompiled C Extension by library name (no `lib` prefix or
325
+ # platform-specific extension). See `samples/12_c_extensions`.
326
+ #
327
+ # Indie or Pro license to compile C Extensions or publish games that use
328
+ # them. Standard can load them in dev mode only; calling this in
329
+ # production raises.
330
+ #
331
+ # @param name [String]
332
+ # @return [void]
333
+ def dlopen name; end
334
+
335
+ # Indie or Pro license.
336
+ #
337
+ # @param name [String, nil] library name, to get its full path
338
+ # @return [String] the path searched for dynamic libraries by #dlopen
339
+ def get_dlopen_path name = nil; end
340
+
341
+ # Updates the `hd_max_scale` metadata value while the game is running,
342
+ # for testing scaling on edge-to-edge displays. Development only.
343
+ #
344
+ # Pro license (no-op otherwise).
345
+ #
346
+ # @param scale [Integer] `100` (720p), `125` (HD+), `150` (1080p), `175` (Full HD+),
347
+ # `200` (1440p), `250` (1800p), `300` (4k), or `400` (5k)
348
+ # @return [void]
349
+ def set_hd_max_scale scale; end
350
+
351
+ # Adds or removes the letterbox (`hd_letterbox` in `game_metadata.txt`)
352
+ # while the game is running. Development only.
353
+ #
354
+ # Pro license (no-op otherwise).
355
+ #
356
+ # @return [void]
357
+ def toggle_hd_letterbox; end
358
+
359
+ # Adds (`true`) or removes (`false`) the letterbox (`hd_letterbox` in
360
+ # `game_metadata.txt`) while the game is running. Development only.
361
+ #
362
+ # Pro license (no-op otherwise).
363
+ #
364
+ # @param letterbox [Boolean]
365
+ # @return [void]
366
+ def set_hd_letterbox letterbox; end
367
+
368
+ # Starts text input so `args.inputs.text` is populated. On touch devices
369
+ # this shows the on-screen keyboard.
370
+ #
371
+ # Pro license.
372
+ #
373
+ # @return [void]
374
+ def start_text_input; end
375
+
376
+ # Stops text input and dismisses the on-screen keyboard.
377
+ #
378
+ # Pro license.
379
+ #
380
+ # @return [void]
381
+ def stop_text_input; end
382
+
383
+ # @!endgroup
384
+
385
+ # A request received by the in-game web server (`DR.start_server!`), from
386
+ # `args.inputs.http_requests`. Requests not responded to are rejected
387
+ # automatically after 30 seconds.
388
+ #
389
+ # Pro license.
390
+ class HTTPRequest
391
+ # @return [String]
392
+ attr_reader :id
393
+
394
+ # @return [String] client address
395
+ attr_reader :address
396
+
397
+ # @return [String] e.g. `"GET"`, `"POST"`
398
+ attr_reader :method
399
+
400
+ # @return [String] e.g. `"/"`
401
+ attr_reader :uri
402
+
403
+ # @return [Hash{String => String}]
404
+ attr_reader :headers
405
+
406
+ # @return [String, nil]
407
+ attr_reader :raw_body
408
+
409
+ # @return [Object] the request body
410
+ attr_reader :body
411
+
412
+ # @param httpcode [Integer] e.g. `200`
413
+ # @param body [String, nil]
414
+ # @param headers [Hash{String => String}, nil]
415
+ # @return [void]
416
+ def respond httpcode, body = nil, headers = nil; end
417
+
418
+ # Responds with `400` and a plain-text rejection message.
419
+ # @return [void]
420
+ def reject; end
421
+ end
422
+ end
423
+ end
424
+
425
+ # DragonRuby routes these through the runtime's file functions (paths are
426
+ # relative to the game directory).
427
+ class File
428
+ class << self
429
+ # Same as `DR.append_file`.
430
+ #
431
+ # @param path [String]
432
+ # @param contents [String]
433
+ # @return [void]
434
+ def append path, contents; end
435
+ end
436
+ end
@@ -0,0 +1,85 @@
1
+ class String
2
+ # Splits self into lines of at most `length` characters, breaking at word
3
+ # boundaries (or at characters when self has multibyte characters).
4
+ #
5
+ # @param length [Integer]
6
+ # @return [Array<String>]
7
+ def wrapped_lines length; end
8
+
9
+ # @param length [Integer]
10
+ # @return [String] self with newlines inserted so no line exceeds `length` characters
11
+ def wrap length; end
12
+
13
+ # @return [Boolean] true if self contains a newline
14
+ def multiline?; end
15
+
16
+ # @param amount [Integer]
17
+ # @param char [String]
18
+ # @return [String] self with every line but the first indented by `amount` `char`s
19
+ def indent_lines amount, char = " "; end
20
+
21
+ # @param count [Integer]
22
+ # @param indent_char [String]
23
+ # @param pad_line_with_space [Boolean]
24
+ # @return [String] self with every line indented by `count` `indent_char`s
25
+ def indent count, indent_char: " ", pad_line_with_space: false; end
26
+
27
+ # @return [String] self wrapped in double quotes
28
+ def quote; end
29
+
30
+ # @return [String] same as #strip
31
+ def trim; end
32
+
33
+ # @return [String, nil] same as #strip!
34
+ def trim!; end
35
+
36
+ # @return [String] same as #lstrip
37
+ def ltrim; end
38
+
39
+ # @return [String, nil] same as #lstrip!
40
+ def ltrim!; end
41
+
42
+ # @return [String] same as #rstrip
43
+ def rtrim; end
44
+
45
+ # @return [String, nil] same as #rstrip!
46
+ def rtrim!; end
47
+
48
+ # @return [Integer, nil] byte value of the first character
49
+ def char_byte; end
50
+
51
+ # @param index [Integer]
52
+ # @param char [String]
53
+ # @return [String] a copy of self with `char` inserted at `index`
54
+ def insert_character_at index, char; end
55
+
56
+ # @param index [Integer]
57
+ # @return [String] a copy of self without the character at `index`
58
+ def excluding_character_at index; end
59
+
60
+ # @return [String] a copy of self without its last character
61
+ def excluding_last_character; end
62
+
63
+ class << self
64
+ # @param string [String]
65
+ # @param length [Integer]
66
+ # @return [Array<String>] see String#wrapped_lines
67
+ def wrapped_lines string, length; end
68
+
69
+ # Vertical anchors for centering lines of text on a point: pass the
70
+ # result as each label's `anchor_y`.
71
+ #
72
+ # @example
73
+ # String.line_anchors(["one", "two"]).map do |anchor, text|
74
+ # { x: 640, y: 360, text: text, anchor_x: 0.5, anchor_y: anchor }
75
+ # end
76
+ #
77
+ # @param line_count_or_strings [Integer, Array<String>]
78
+ # @return [Array<Float>, Array<Array(Float, String)>] anchors, or `[anchor, string]` pairs when given strings
79
+ def line_anchors line_count_or_strings; end
80
+
81
+ # @param str [String]
82
+ # @return [Array<String>] the UTF-8 characters of `str`
83
+ def utf8_chars str; end
84
+ end
85
+ end
@@ -0,0 +1,193 @@
1
+ # Phantom types for the shapes DragonRuby passes around as plain Hashes.
2
+ # None of these exist in the runtime.
3
+ #
4
+ # - The modules (`Typing::Point`, `Typing::Rect`, `Typing::Line`, ...) describe
5
+ # duck-typed arguments: a Hash with those keys, or any object with those
6
+ # methods. Parameters use them as `[Typing::Rect, Object]` so that any value
7
+ # still type-checks.
8
+ # - The `*Hash` classes describe Hashes DragonRuby returns. They subclass
9
+ # Hash, so both the Hash methods and the fields complete.
10
+ module Typing
11
+ # phantom type denoting a line-like object
12
+ module Line
13
+ # @return [Integer, Float]
14
+ attr_reader :x, :y, :x2, :y2
15
+ end
16
+
17
+ # phantom type denoting a circle-like object
18
+ module Circle
19
+ # @return [Integer, Float]
20
+ attr_reader :x, :y, :radius
21
+ end
22
+
23
+ # phantom type denoting an object with a color
24
+ module Color
25
+ # @return [Integer] `0` to `255`
26
+ attr_reader :r, :g, :b, :a
27
+ end
28
+
29
+ # phantom type denoting an object with a size
30
+ module Size
31
+ # @return [Integer, Float]
32
+ attr_reader :w, :h
33
+ end
34
+
35
+ # A `{ x:, y: }` Hash: a point or a vector.
36
+ class PointHash < ::Hash
37
+ include Typing::Point
38
+ end
39
+
40
+ # A `{ x:, y:, w:, h: }` Hash.
41
+ class RectHash < ::Hash
42
+ include Typing::Rect
43
+ end
44
+
45
+ # A `{ x:, y:, w:, h:, center: { x:, y: } }` Hash, as returned by
46
+ # `Layout.rect` and `Geometry.rect_props`.
47
+ class RectPropsHash < RectHash
48
+ # @return [Typing::PointHash] center of the rect
49
+ attr_reader :center
50
+ end
51
+
52
+ # A `{ x:, y:, x2:, y2: }` Hash.
53
+ class LineHash < ::Hash
54
+ include Typing::Line
55
+ end
56
+
57
+ # A `{ x:, y:, radius: }` Hash.
58
+ class CircleHash < ::Hash
59
+ include Typing::Circle
60
+ end
61
+
62
+ # A `{ r:, g:, b:, a: }` Hash.
63
+ class ColorHash < ::Hash
64
+ include Typing::Color
65
+ end
66
+
67
+ # A `{ w:, h: }` Hash.
68
+ class SizeHash < ::Hash
69
+ include Typing::Size
70
+ end
71
+
72
+ # The Hash returned by `Numeric#frame`.
73
+ class FrameHash < ::Hash
74
+ # @return [Integer, nil] index of the sprite to show; `nil` before the start or after a non-repeating end
75
+ attr_reader :frame_index
76
+
77
+ # @return [Integer]
78
+ attr_reader :frame_count
79
+
80
+ # @return [Integer]
81
+ attr_reader :frames_left
82
+
83
+ # @return [Boolean]
84
+ attr_reader :started
85
+
86
+ # @return [Boolean]
87
+ attr_reader :completed
88
+
89
+ # @return [Integer] ticks since the start
90
+ attr_reader :elapsed_time
91
+
92
+ # @return [Integer, nil] ticks spent on the current frame
93
+ attr_reader :frame_elapsed_time
94
+
95
+ # @return [Integer] ticks for one run of the animation
96
+ attr_reader :duration
97
+
98
+ # @return [Integer]
99
+ attr_reader :hold_for
100
+
101
+ # @return [Boolean]
102
+ attr_reader :repeat
103
+
104
+ # @return [Object, nil] the `metadata:` that was passed in
105
+ attr_reader :metadata
106
+ end
107
+
108
+ # The Hash returned by `DR.http_get` and the other http functions. It is
109
+ # filled in asynchronously: check #complete before reading the response.
110
+ class HTTPResponseHash < ::Hash
111
+ # @return [Boolean] true once the request has finished
112
+ attr_reader :complete
113
+
114
+ # @return [Integer] e.g. `200`
115
+ attr_reader :http_response_code
116
+
117
+ # @return [String]
118
+ attr_reader :response_data
119
+
120
+ # @return [Hash{String => String}]
121
+ attr_reader :response_headers
122
+
123
+ # Set to true to cancel the request.
124
+ # @return [Boolean]
125
+ attr_accessor :cancel
126
+ end
127
+
128
+ # The Hash returned by `DR.stat_file`.
129
+ class FileStatHash < ::Hash
130
+ # @return [String]
131
+ attr_reader :path
132
+
133
+ # @return [Integer]
134
+ attr_reader :file_size
135
+
136
+ # @return [Integer]
137
+ attr_reader :mod_time, :create_time, :access_time
138
+
139
+ # @return [Boolean]
140
+ attr_reader :readonly
141
+
142
+ # @return [Symbol] `:regular`, `:directory`, `:symlink`, or `:other`
143
+ attr_reader :file_type
144
+ end
145
+
146
+ # The Hash returned by `args.inputs.keyboard.keys`.
147
+ class KeyStatesHash < ::Hash
148
+ # @return [Array<Symbol>] keys pressed on this frame
149
+ attr_reader :down
150
+
151
+ # @return [Array<Symbol>] keys held
152
+ attr_reader :held
153
+
154
+ # @return [Array<Symbol>] keys pressed on this frame or held
155
+ attr_reader :down_or_held
156
+
157
+ # @return [Array<Symbol>] keys released on this frame
158
+ attr_reader :up
159
+
160
+ # @return [Array<Symbol>] keys pressed or repeated
161
+ attr_reader :repeat
162
+ end
163
+
164
+ # An entry of `args.outputs.render_target_state`.
165
+ class RenderTargetEntryHash < ::Hash
166
+ # @return [String] render target name
167
+ attr_reader :id, :path
168
+
169
+ # @return [Boolean] true once the texture can be used
170
+ attr_reader :ready
171
+
172
+ # @return [Integer] `Kernel.tick_count` the texture is expected to be ready
173
+ attr_reader :ready_at
174
+
175
+ # @return [Integer]
176
+ attr_reader :updated_at, :global_updated_at, :global_created_at
177
+
178
+ # @return [Integer, Float]
179
+ attr_reader :w, :h
180
+ end
181
+
182
+ # The Hash assigned to `outputs.shader`.
183
+ class ShaderHash < ::Hash
184
+ # @return [String] the required shader file
185
+ attr_reader :path
186
+
187
+ # @return [Array<Hash>] values bound in order, each `{ type: :int | :float, value: }`
188
+ attr_reader :uniforms
189
+
190
+ # @return [Array<Symbol>] render targets bound as additional textures
191
+ attr_reader :textures
192
+ end
193
+ end