Class: MINTo::Mouse::CoordinateTracker

Inherits:
Object
  • Object
show all
Includes:
EventMachine::Deferrable
Defined in:
lib/MINT-core/model/ir/mouse_old.rb

Instance Method Summary collapse

Constructor Details

#initialize(mouse) ⇒ CoordinateTracker

Returns a new instance of CoordinateTracker.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/MINT-core/model/ir/mouse_old.rb', line 19

def initialize(mouse)
  @mouse = mouse
  p "handling juggernait"
  Redis.new.subscribe("juggernaut") do |on|
    on.mon.message do |msg|
      r = msg.parseJSON
      if (r["channels"].eql? "pointer")
        @x,@y = r["data"].split
      end
    end
  end
end

Instance Method Details

#save(state) ⇒ Object



31
32
33
34
35
36
# File 'lib/MINT-core/model/ir/mouse_old.rb', line 31

def save(state)
  @mouse.x=@x
  @mouse.y=@y
  @mouse.process_event(state)
  p "stopped"
end