Class: Reight::MapEditor::Tool
- Inherits:
-
Button
- Object
- Button
- Reight::MapEditor::Tool
show all
- Defined in:
- lib/reight/app/map/tool.rb
Instance Attribute Summary collapse
Attributes inherited from Button
#icon, #label
Instance Method Summary
collapse
-
#canvas ⇒ Object
-
#canvas_clicked(x, y, button) ⇒ Object
-
#canvas_dragged(x, y, button) ⇒ Object
-
#canvas_moved(x, y) ⇒ Object
-
#canvas_pressed(x, y, button) ⇒ Object
-
#canvas_released(x, y, button) ⇒ Object
-
#chips ⇒ Object
-
#history ⇒ Object
-
#initialize(app, *a, **k, &b) ⇒ Tool
constructor
-
#name ⇒ Object
-
#pick_chip(x, y) ⇒ Object
Methods inherited from Button
#click, #disabled?, #disabled_icon, #draw, #enabled?, #hover, #pressed, #pressing?, #released, #sprite
Methods included from HasHelp
#help, #set_help
Methods included from Hookable
#hook
#activated, #activated!, #active=, #active?
Constructor Details
#initialize(app, *a, **k, &b) ⇒ Tool
Returns a new instance of Tool.
6
7
8
9
|
# File 'lib/reight/app/map/tool.rb', line 6
def initialize(app, *a, **k, &b)
super(*a, **k, &b)
@app = app
end
|
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
11
12
13
|
# File 'lib/reight/app/map/tool.rb', line 11
def app
@app
end
|
Instance Method Details
#canvas ⇒ Object
13
|
# File 'lib/reight/app/map/tool.rb', line 13
def canvas = app.canvas
|
#canvas_clicked(x, y, button) ⇒ Object
30
|
# File 'lib/reight/app/map/tool.rb', line 30
def canvas_clicked( x, y, button) = nil
|
#canvas_dragged(x, y, button) ⇒ Object
29
|
# File 'lib/reight/app/map/tool.rb', line 29
def canvas_dragged( x, y, button) = nil
|
#canvas_moved(x, y) ⇒ Object
28
|
# File 'lib/reight/app/map/tool.rb', line 28
def canvas_moved( x, y) = nil
|
#canvas_pressed(x, y, button) ⇒ Object
26
|
# File 'lib/reight/app/map/tool.rb', line 26
def canvas_pressed( x, y, button) = nil
|
#canvas_released(x, y, button) ⇒ Object
27
|
# File 'lib/reight/app/map/tool.rb', line 27
def canvas_released(x, y, button) = nil
|
#chips ⇒ Object
17
|
# File 'lib/reight/app/map/tool.rb', line 17
def chips = app.chips
|
#history ⇒ Object
15
|
# File 'lib/reight/app/map/tool.rb', line 15
def history = app.history
|
#name ⇒ Object
19
|
# File 'lib/reight/app/map/tool.rb', line 19
def name = self.class.name.split('::').last
|
#pick_chip(x, y) ⇒ Object
21
22
23
24
|
# File 'lib/reight/app/map/tool.rb', line 21
def pick_chip(x, y)
chip = canvas.chip_at_cursor or return
chips.mouse_clicked chip.x, chip.y
end
|