Class: Metro::UI::GridDrawer
- Defined in:
- lib/metro/models/ui/grid_drawer.rb
Overview
The grid drawer will draw a grid from the specified position out to the specified dimensions at the spacing interval provided. This is currently used when the edit mode is enabled.
Constant Summary
Constants included from Metro::Units
Instance Attribute Summary collapse
-
#color ⇒ Object
The color of the grid lines.
-
#dimensions ⇒ Object
The dimension of the grid.
-
#enabled ⇒ Object
This controls whether the grid should be drawn.
-
#position ⇒ Object
The position to start drawing the grid.
-
#spacing ⇒ Object
The interval which to draw the lines.
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#_load, #_save, #after_initialize, #bounds, #create, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #to_hash, #update, #update_completed?
Methods included from HasEvents
Methods included from KeyValueCoding
Methods included from PropertyOwner
Constructor Details
This class inherits a constructor from Metro::Model
Instance Attribute Details
#color ⇒ Object
The color of the grid lines
24 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 24 property :color, default: "rgba(255,255,255,0.1)" |
#dimensions ⇒ Object
The dimension of the grid
32 33 34 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 32 property :dimensions do Dimensions.of Game.width, Game.height end |
#enabled ⇒ Object
This controls whether the grid should be drawn. By default the grid will be drawn.
39 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 39 property :enabled, type: :boolean, default: true |
#position ⇒ Object
The position to start drawing the grid
20 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 20 property :position, default: Point.at(0,0,100) |
#spacing ⇒ Object
The interval which to draw the lines
28 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 28 property :spacing, type: :numeric, default: 10 |
Instance Method Details
#draw ⇒ Object
45 46 47 48 49 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 45 def draw return unless enabled draw_horizontal_lines draw_vertical_lines end |
#show ⇒ Object
41 42 43 |
# File 'lib/metro/models/ui/grid_drawer.rb', line 41 def show self.saveable_to_view = false end |