samples/02_input_basics/05_controller/app/main.rb
def process_inputs
    state.buttons = []

    state.buttons << { x: 100,  y: 500, active: inputs.controller_one.key_held.l1, text: "L1"}
    state.buttons << { x: 100,  y: 600, active: inputs.controller_one.key_held.l2, text: "L2"}
    state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"}
    state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"}
    state.buttons << { x: 540,  y: 450, active: inputs.controller_one.key_held.select, text: "Select"}
    state.buttons << { x: 660,  y: 450, active: inputs.controller_one.key_held.start, text: "Start"}
    state.buttons << { x: 200,  y: 300, active: inputs.controller_one.key_held.left, text: "Left"}
    state.buttons << { x: 300,  y: 400, active: inputs.controller_one.key_held.up, text: "Up"}
    state.buttons << { x: 400,  y: 300, active: inputs.controller_one.key_held.right, text: "Right"}
    state.buttons << { x: 300,  y: 200, active: inputs.controller_one.key_held.down, text: "Down"}
    state.buttons << { x: 800,  y: 300, active: inputs.controller_one.key_held.x, text: "X"}
    state.buttons << { x: 900,  y: 400, active: inputs.controller_one.key_held.y, text: "Y"}
    state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"}
    state.buttons << { x: 900,  y: 200, active: inputs.controller_one.key_held.b, text: "B"}
    state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100,
                       y: 100 + inputs.controller_one.left_analog_y_perc * 100,
                       active: inputs.controller_one.key_held.l3,
                       text: "L3" }
    state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100,
                       y: 100 + inputs.controller_one.right_analog_y_perc * 100,
                       active: inputs.controller_one.key_held.r3,
                       text: "R3" }
  end
# Starts with an empty collection of buttons.
# Adds buttons that are on the controller to the collection.
Starts with an empty collection of buttons.
Adds buttons that are on the controller to the collection.
Starts with an empty collection of buttons . Adds buttons that are on the controller to the collection .
def process_inputs
    state.buttons = []
    state.buttons << { x: 100,  y: 500, active: inputs.controller_one.key_held.l1, text: "L1"}
    state.buttons << { x: 100,  y: 600, active: inputs.controller_one.key_held.l2, text: "L2"}
    state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"}
    state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"}
    state.buttons << { x: 540,  y: 450, active: inputs.controller_one.key_held.select, text: "Select"}
    state.buttons << { x: 660,  y: 450, active: inputs.controller_one.key_held.start, text: "Start"}
    state.buttons << { x: 200,  y: 300, active: inputs.controller_one.key_held.left, text: "Left"}
    state.buttons << { x: 300,  y: 400, active: inputs.controller_one.key_held.up, text: "Up"}
    state.buttons << { x: 400,  y: 300, active: inputs.controller_one.key_held.right, text: "Right"}
    state.buttons << { x: 300,  y: 200, active: inputs.controller_one.key_held.down, text: "Down"}
    state.buttons << { x: 800,  y: 300, active: inputs.controller_one.key_held.x, text: "X"}
    state.buttons << { x: 900,  y: 400, active: inputs.controller_one.key_held.y, text: "Y"}
    state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"}
    state.buttons << { x: 900,  y: 200, active: inputs.controller_one.key_held.b, text: "B"}
    state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100,
                       y: 100 + inputs.controller_one.left_analog_y_perc * 100,
                       active: inputs.controller_one.key_held.l3,
                       text: "L3" }
    state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100,
                       y: 100 + inputs.controller_one.right_analog_y_perc * 100,
                       active: inputs.controller_one.key_held.r3,
                       text: "R3" }
  end
def process_inputs state . buttons = [ ] state . buttons << { x : 100 , y : 500 , active : inputs . controller_one . key_held . l1 , text : "L1" } state . buttons << { x : 100 , y : 600 , active : inputs . controller_one . key_held . l2 , text : "L2" } state . buttons << { x : 1100 , y : 500 , active : inputs . controller_one . key_held . r1 , text : "R1" } state . buttons << { x : 1100 , y : 600 , active : inputs . controller_one . key_held . r2 , text : "R2" } state . buttons << { x : 540 , y : 450 , active : inputs . controller_one . key_held . select , text : "Select" } state . buttons << { x : 660 , y : 450 , active : inputs . controller_one . key_held . start , text : "Start" } state . buttons << { x : 200 , y : 300 , active : inputs . controller_one . key_held . left , text : "Left" } state . buttons << { x : 300 , y : 400 , active : inputs . controller_one . key_held . up , text : "Up" } state . buttons << { x : 400 , y : 300 , active : inputs . controller_one . key_held . right , text : "Right" } state . buttons << { x : 300 , y : 200 , active : inputs . controller_one . key_held . down , text : "Down" } state . buttons << { x : 800 , y : 300 , active : inputs . controller_one . key_held . x , text : "X" } state . buttons << { x : 900 , y : 400 , active : inputs . controller_one . key_held . y , text : "Y" } state . buttons << { x : 1000 , y : 300 , active : inputs . controller_one . key_held . a , text : "A" } state . buttons << { x : 900 , y : 200 , active : inputs . controller_one . key_held . b , text : "B" } state . buttons << { x : 450 + inputs . controller_one . left_analog_x_perc * 100 , y : 100 + inputs . controller_one . left_analog_y_perc * 100 , active : inputs . controller_one . key_held . l3 , text : "L3" } state . buttons << { x : 750 + inputs . controller_one . right_analog_x_perc * 100 , y : 100 + inputs . controller_one . right_analog_y_perc * 100 , active : inputs . controller_one . key_held . r3 , text : "R3" } end
Starts with an empty collection of buttons.
Starts with an empty collection of buttons .