Class: Util::DragSprite
- Defined in:
- scripts/01000 Util/00700 DragSprite.rb
Overview
Note:
Draggable stuff should respond to simple_mouse_in? and set_position
Helper that allow sprites to be dragged
This helper can manage various sprites and each sprite can have 3 procs :
- start_drag: a proc called with sprite as argument when a sprite starts being dragged
- update_drag: a proc called with sprite as argument each time the mouse move (the sprite is moved automatically)
- end_drag: a proc called when the sprite stops being dragged (usefull to put the sprite back to its regular pos)
Instance Attribute Summary collapse
-
#dragging ⇒ #simple_mouse_in?
readonly
Return the sprite that is being dragged.
Instance Method Summary collapse
-
#add(sprite, start_drag: nil, update_drag: nil, end_drag: nil)
Add a sprite to drag.
-
#initialize ⇒ DragSprite
constructor
Create the DragSprite interface.
-
#update
Update the draging process.
Constructor Details
#initialize ⇒ DragSprite
Create the DragSprite interface
Instance Attribute Details
#dragging ⇒ #simple_mouse_in? (readonly)
Return the sprite that is being dragged
Instance Method Details
#add(sprite, start_drag: nil, update_drag: nil, end_drag: nil)
Add a sprite to drag
#update
Update the draging process