samples/07_advanced_rendering/03_render_target_viewports/app/main.rb
def controller_tech_demo
    x = 460
    outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")
    outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")
    outputs.labels << small_label(x, 8, "Check console window for more info.")

    if inputs.controller_one.key_down.a # if "a" is in "down" state
      outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")
      puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred
    elsif inputs.controller_one.key_held.a # if "a" is held down
      outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")
    elsif inputs.controller_one.key_up.a # if "a" is in up state
      outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")
      puts "\"a\" key up at #{inputs.controller_one.key_up.a}"
    else # if no event has occurred
      outputs.labels << small_label(x, 9, "\"a\" button state is nil.")
    end

    # border around controller input demo section
    outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]
  end
# Uses small labels to show whether the "a" button on the controller is down, held, or up.
# y value of each small label is set by calling the row_to_px method
Uses small labels to show whether the "a" button on the controller is down, held, or up.
y value of each small label is set by calling the row_to_px method
Uses small labels to show whether the " a " button on the controller is down held or up . y value of each small label is set by calling the row_to_px method
def controller_tech_demo
    x = 460
    outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")
    outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")
    outputs.labels << small_label(x, 8, "Check console window for more info.")
    if inputs.controller_one.key_down.a 
      outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")
      puts "\"a\" button down at #{inputs.controller_one.key_down.a}" 
    elsif inputs.controller_one.key_held.a 
      outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")
    elsif inputs.controller_one.key_up.a 
      outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")
      puts "\"a\" key up at #{inputs.controller_one.key_up.a}"
    else 
      outputs.labels << small_label(x, 9, "\"a\" button state is nil.")
    end
    outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]
  end
def controller_tech_demo x = 460 outputs . labels << small_label ( x , 6 , "Controller one input: inputs.controller_one" ) outputs . labels << small_label ( x , 7 , "Current state of the \"a\" button." ) outputs . labels << small_label ( x , 8 , "Check console window for more info." ) if inputs . controller_one . key_down . a outputs . labels << small_label ( x , 9 , "\"a\" button down: #{inputs.controller_one.key_down.a}" ) puts "\"a\" button down at #{inputs.controller_one.key_down.a}" elsif inputs . controller_one . key_held . a outputs . labels << small_label ( x , 9 , "\"a\" button held: #{inputs.controller_one.key_held.a}" ) elsif inputs . controller_one . key_up . a outputs . labels << small_label ( x , 9 , "\"a\" button up: #{inputs.controller_one.key_up.a}" ) puts "\"a\" key up at #{inputs.controller_one.key_up.a}" else outputs . labels << small_label ( x , 9 , "\"a\" button state is nil." ) end outputs . borders << [ 455 , row_to_px ( 10 ) , 360 , row_to_px ( 6 ) . shift_up ( 5 ) - row_to_px ( 10 ) ] end
Uses small labels to show whether the "a" button on the controller is down, held, or up.
Uses small labels to show whether the " a " button on the controller is down held or up .
# if "a" is in "down" state # prints frame the event occurred # if "a" is held down # if "a" is in up state # if no event has occurred # border around controller input demo section