samples/07_advanced_rendering/03_render_target_viewports/app/main.rb
# Outputs when the mouse was clicked, as well as the coordinates on the screen
# of where the click occurred
Outputs when the mouse was clicked, as well as the coordinates on the screen
of where the click occurred
Outputs when the mouse was clicked as well as the coordinates on the screen of where the click occurred
def mouse_tech_demo
    x = 460
    outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse")
    if inputs.mouse.click 
      state.last_mouse_click = inputs.mouse.click 
    end
    if state.last_mouse_click 
      outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}")
      outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}")
    else 
      outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.")
      outputs.labels << small_label(x, 13, "Please click mouse.")
    end
  end
def mouse_tech_demo x = 460 outputs . labels << small_label ( x , 11 , "Mouse input: inputs.mouse" ) if inputs . mouse . click state . last_mouse_click = inputs . mouse . click end if state . last_mouse_click outputs . labels << small_label ( x , 12 , "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}" ) outputs . labels << small_label ( x , 13 , "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}" ) else outputs . labels << small_label ( x , 12 , "Mouse click has not occurred yet." ) outputs . labels << small_label ( x , 13 , "Please click mouse." ) end end
Outputs when the mouse was clicked, as well as the coordinates on the screen
of where the click occurred
Outputs when the mouse was clicked as well as the coordinates on the screen of where the click occurred
# if click has a value and is not nil # coordinates of click are stored # if mouse is clicked (has coordinates as value) # outputs the time (frame) the click occurred, as well as how many frames have passed since the event # outputs coordinates of click # otherwise if the mouse has not been clicked