scene.gd 581 B

12345678910111213141516171819202122232425262728293031323334
  1. extends Node2D
  2. var iTime=0.0
  3. var iFrame=0
  4. var iMouse=Vector2()
  5. var iResolution=Vector2(1280,720)
  6. var inp_used=false
  7. var inp_used_id=0
  8. var gid=0
  9. var gidx=-1
  10. var live_box_elem=0
  11. var live_circle_elem=0
  12. var live_line_elem=0
  13. var live_text_elem=0
  14. var live_tri_elem=0
  15. const max_elems=5 #same in shaders
  16. func _ready():
  17. pass
  18. func upd_imouse():
  19. var m_pos=get_viewport().get_mouse_position()/iResolution
  20. m_pos.x=clamp(m_pos.x,0,1)
  21. m_pos.y=clamp(m_pos.y,0,1)
  22. iMouse=Vector2(m_pos.x*iResolution.x,iResolution.y*m_pos.y)
  23. func _process(delta):
  24. iTime+=delta
  25. iFrame+=1
  26. upd_imouse()