Class: MINT::Joypad

Inherits:
Interactor show all
Defined in:
lib/MINT-core/model/ir/joypad.rb

Constant Summary

Constants inherited from Interactor

Interactor::PUBLISH_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Interactor

class_from_channel_name, #create_attribute_channel_name, create_channel_name, #create_channel_w_name, get, getModel, #getSCXML, get_dm, #init_statemachine, #is_in?, #new_states, notify, #process_event, #process_event!, #process_event_vars, #publish_update, #states, #states=, #sync_event, #sync_states, #to_dot, wait

Methods included from InteractorHelpers

#restart_timeout, #start_timeout, #stop_timeout

Instance Method Details

#initialize_statemachineObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/MINT-core/model/ir/joypad.rb', line 4

def initialize_statemachine
  if @statemachine.blank?
    @statemachine = Statemachine.build do

      trans :disconnected,:connect, :connected
      trans :connected, :disconnect, :disconnected

      superstate :connected do
        state :released
        superstate :pressed do
          state :left
          state :right
          state :down
          state :up
          event :release, :released
        end
        event :press_left, :left
        event :press_right, :right
        event :press_up, :up
        event :press_down, :down
        event :disconnect, :disconnected
      end
    end
  end
end