Main.gd 593 B

12345678910111213141516171819202122
  1. extends Node2D
  2. func _process(_delta):
  3. # Keep redrawing on every frame.
  4. queue_redraw()
  5. func _draw():
  6. # Get the touch helper singleton.
  7. var touch_helper = get_node(^"/root/TouchHelper")
  8. # Draw every pointer as a circle.
  9. for ptr_index in touch_helper.state.keys():
  10. var pos = touch_helper.state[ptr_index]
  11. var color = _get_color_for_ptr_index(ptr_index)
  12. color.a = 0.75
  13. draw_circle(pos, 40.0, color)
  14. # Just a way of getting different colors.
  15. func _get_color_for_ptr_index(index):
  16. var x = (index % 7) + 1
  17. return Color(float(bool(x & 1)), float(bool(x & 2)), float(bool(x & 4)))