Class: GTK::FingerTouch

Inherits:
Object show all
Defined in:
dragon/inputs.rb

Overview

Provides access to multitouch input

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFingerTouch

Returns a new instance of FingerTouch.


595
596
597
598
599
600
601
602
603
604
605
# File 'dragon/inputs.rb', line 595

def initialize
  @moved = false
  @moved_at = 0
  @global_moved_at = 0
  @down_at = 0
  @global_down_at = 0
  @touch_order = 0
  @first_tick_down = true
  @x = 0
  @y = 0
end

Instance Attribute Details

#down_atObject

Returns the value of attribute down_at


586
587
588
# File 'dragon/inputs.rb', line 586

def down_at
  @down_at
end

#first_tick_downObject

Returns the value of attribute first_tick_down


586
587
588
# File 'dragon/inputs.rb', line 586

def first_tick_down
  @first_tick_down
end

#global_down_atObject

Returns the value of attribute global_down_at


586
587
588
# File 'dragon/inputs.rb', line 586

def global_down_at
  @global_down_at
end

#global_moved_atObject

Returns the value of attribute global_moved_at


586
587
588
# File 'dragon/inputs.rb', line 586

def global_moved_at
  @global_moved_at
end

#movedObject

Returns the value of attribute moved


586
587
588
# File 'dragon/inputs.rb', line 586

def moved
  @moved
end

#moved_atObject

Returns the value of attribute moved_at


586
587
588
# File 'dragon/inputs.rb', line 586

def moved_at
  @moved_at
end

#touch_orderObject

Returns the value of attribute touch_order


586
587
588
# File 'dragon/inputs.rb', line 586

def touch_order
  @touch_order
end

#xObject

Returns the value of attribute x


586
587
588
# File 'dragon/inputs.rb', line 586

def x
  @x
end

#yObject

Returns the value of attribute y


586
587
588
# File 'dragon/inputs.rb', line 586

def y
  @y
end

Instance Method Details

#inside_circle?(center, radius) ⇒ Boolean

Returns:

  • (Boolean)

615
616
617
# File 'dragon/inputs.rb', line 615

def inside_circle? center, radius
  point.point_inside_circle? center, radius
end

#inside_rect?(rect) ⇒ Boolean

Returns:

  • (Boolean)

611
612
613
# File 'dragon/inputs.rb', line 611

def inside_rect? rect
  point.inside_rect? rect
end

#pointObject Also known as: position


607
608
609
# File 'dragon/inputs.rb', line 607

def point
  [@x, @y].point
end

#serializeObject


621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'dragon/inputs.rb', line 621

def serialize
  result = {}
  result[:x] = @x
  result[:y] = @y
  result[:touch_order] = @touch_order
  result[:moved] = @moved
  result[:moved_at] = @moved_at
  result[:global_moved_at] = @global_moved_at
  result[:down_at] = @down_at
  result[:global_down_at] = @global_down_at

  result
end

#to_sObject Also known as: inspect


635
636
637
# File 'dragon/inputs.rb', line 635

def to_s
  serialize.to_s
end