class DemCurves::RubygameUtils::EditorHandle
Public Class Methods
new(loc=[50, 50], size=10)
click to toggle source
# File lib/rubygame-util/control-handles.rb, line 41 def initialize(loc=[50, 50], size=10) @groups =[] @depth = 0 @rect = Rubygame::Rect.new 0, 0, size, size @rect.c = loc @image = Rubygame::Surface.new [size, size], 0, [Rubygame::HWSURFACE, Rubygame::SRCALPHA] @image.fill([180, 180, 180]) @attached = false @constraints = [] end
Public Instance Methods
attach_to(control_point)
click to toggle source
# File lib/rubygame-util/control-handles.rb, line 55 def attach_to(control_point) unless @attached @attached = true @control_point = control_point @rect.c = control_point.loc.to_a end end
move(rel)
click to toggle source
# File lib/rubygame-util/control-handles.rb, line 63 def move(rel) if @attached @control_point.shift rel end end
update()
click to toggle source
# File lib/rubygame-util/control-handles.rb, line 69 def update if @attached @rect.c = @control_point.loc.to_a end end