system.gd 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. extends Node
  2. enum PhysicsEngine {
  3. GODOT_PHYSICS,
  4. OTHER,
  5. }
  6. var _engine = PhysicsEngine.OTHER
  7. func _enter_tree():
  8. process_mode = Node.PROCESS_MODE_ALWAYS
  9. get_tree().debug_collisions_hint = true
  10. var engine_string = ProjectSettings.get_setting("physics/3d/physics_engine")
  11. match engine_string:
  12. "DEFAULT":
  13. _engine = PhysicsEngine.GODOT_PHYSICS
  14. "GodotPhysics3D":
  15. _engine = PhysicsEngine.GODOT_PHYSICS
  16. _:
  17. _engine = PhysicsEngine.OTHER
  18. func _process(_delta):
  19. if Input.is_action_just_pressed(&"toggle_full_screen"):
  20. if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
  21. DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
  22. else:
  23. DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
  24. if Input.is_action_just_pressed(&"toggle_debug_collision"):
  25. var debug_collision_enabled = not _is_debug_collision_enabled()
  26. _set_debug_collision_enabled(debug_collision_enabled)
  27. if debug_collision_enabled:
  28. Log.print_log("Debug Collision ON")
  29. else:
  30. Log.print_log("Debug Collision OFF")
  31. if Input.is_action_just_pressed(&"toggle_pause"):
  32. get_tree().paused = not get_tree().paused
  33. if Input.is_action_just_pressed(&"exit"):
  34. get_tree().quit()
  35. func get_physics_engine():
  36. return _engine
  37. func _set_debug_collision_enabled(enabled):
  38. get_tree().debug_collisions_hint = enabled
  39. func _is_debug_collision_enabled():
  40. return get_tree().debug_collisions_hint