Module: Chingu::Helpers::InputClient

Included in:
GameObject, GameState, Window
Defined in:
lib/chingu/helpers/input_client.rb

Overview

Input-handler mixin that adds #input= and #input

#input= does 2 things: 1) Initialized an inputmap 2) notifies the parent (could be main Window or a GameState) that the object wants input

In Chingu this is mixed into Window, GameState and GameObject

Instance Method Summary collapse

Instance Method Details

#inputObject



48
49
50
# File 'lib/chingu/helpers/input_client.rb', line 48

def input
  @input
end

#input=(input_map) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chingu/helpers/input_client.rb', line 36

def input=(input_map)
  @input = input_map
  
  if @parent 
    if (@input == nil || @input == {})
      @parent.remove_input_client(self)
    else
      @parent.add_input_client(self)
    end
  end
end