Module: DevTools
- Extended by:
- ArgsUpdate
- Defined in:
- tomes/conjurations/dev_tools/dev_tools.rb
Overview
A module containing some methods and variables to aid development. You can constantly update it like the classes that use ArgsUpdate or you can call it as needed. If you opt for the latter you will need to provide args as the final argument in each method.
Class Method Summary collapse
-
.render_label_primitives(label_hashes, args = self.args) ⇒ Void
A method for rendering a list of label primitives.
-
.render_object_borders(object_list, args = self.args) ⇒ Void
(also: render_hitboxes)
Generates an array of rect hashes from the given list and passes that into ‘args.outputs.primitives`.
-
.render_objects(object_list, args = self.args) ⇒ Void
Generates an array of primitive hashes from the given list and passes that into ‘args.outputs.primitives`.
-
.render_primitives(primitive_hashes, args = self.args) ⇒ Void
Passes the given array of primitive hashes into ‘args.outputs.primitives`.
-
.render_string_array(location, text_array, args = self.args) ⇒ Void
(also: list)
Generates an array of hashes for each string in the given list and passes that into ‘args.outputs.labels`.
Methods included from ArgsUpdate
Class Method Details
.render_label_primitives(label_hashes, args = self.args) ⇒ Void
A method for rendering a list of label primitives.
62 63 64 65 66 |
# File 'tomes/conjurations/dev_tools/dev_tools.rb', line 62 def render_label_primitives(label_hashes, args = self.args) return if text_hashes.nil? args.outputs.labels << label_hashes.each end |
.render_object_borders(object_list, args = self.args) ⇒ Void Also known as: render_hitboxes
Generates an array of rect hashes from the given list and passes that into ‘args.outputs.primitives`.
53 54 55 |
# File 'tomes/conjurations/dev_tools/dev_tools.rb', line 53 def render_object_borders(object_list, args = self.args) args.outputs.borders << object_list.map(&:rect) end |
.render_objects(object_list, args = self.args) ⇒ Void
Generates an array of primitive hashes from the given list and passes that into ‘args.outputs.primitives`.
37 38 39 |
# File 'tomes/conjurations/dev_tools/dev_tools.rb', line 37 def render_objects(object_list, args = self.args) args.outputs.primitives << object_list.map(&:primitives) end |
.render_primitives(primitive_hashes, args = self.args) ⇒ Void
Passes the given array of primitive hashes into ‘args.outputs.primitives`.
45 46 47 |
# File 'tomes/conjurations/dev_tools/dev_tools.rb', line 45 def render_primitives(primitive_hashes, args = self.args) args.outputs.primitives << primitive_hashes end |
.render_string_array(location, text_array, args = self.args) ⇒ Void Also known as: list
This method does not recognize escape characters like “n”.
Generates an array of hashes for each string in the given list and passes that into ‘args.outputs.labels`. Renders strings from top to bottom. Starts from the given location and grows downward.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'tomes/conjurations/dev_tools/dev_tools.rb', line 19 def render_string_array(location, text_array, args = self.args) return if text_array.nil? args.outputs.labels << text_array.map_with_index do |e, i| { x: location[0], y: location[1] - (i * 25), text: e } end end |