Guest User

navdi settings

a guest
Aug 12th, 2020
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tool
  2. extends Node
  3.  
  4. class_name NavdiSettings
  5.  
  6. export var apply_on_click = false
  7. export var width: int = 160
  8. export var height: int = 144
  9. export var zoom: int = 3
  10. export var fps: int = 30
  11. export var project_name: String = "Unnamed Navdi Project"
  12. export var bg_color: Color = Color.black
  13. export var UI_stretch_mode: bool = false
  14.  
  15. func _ready():
  16. if not Engine.editor_hint:
  17. queue_free()
  18.  
  19. func _process(_delta):
  20. if Engine.editor_hint and apply_on_click:
  21. apply_on_click = false
  22. ProjectSettings.set("dynamic_fonts/use_oversampling", false) # stop the errors!
  23. ProjectSettings.set("network/limits/debugger_stdout/max_errors_per_frame",100)
  24. # print("Set max errors per frame to 100")
  25. ProjectSettings.set("display/window/stretch/mode","viewport")
  26. if UI_stretch_mode:
  27. ProjectSettings.set("display/window/stretch/mode","disabled")
  28. # print("Set stretch mode to 'viewport'")
  29. ProjectSettings.set("rendering/quality/2d/use_pixel_snap",true)
  30. # print("Set 2d/pixel snap to true")
  31. ProjectSettings.set("display/window/size/width", width)
  32. ProjectSettings.set("display/window/size/height", height)
  33. ProjectSettings.set("display/window/size/test_width", width * zoom)
  34. ProjectSettings.set("display/window/size/test_height", height * zoom)
  35. # print("Set width x height to ", width, " x ", height)
  36. ProjectSettings.set("application/config/name", project_name)
  37.  
  38. ProjectSettings.set("application/run/main_scene", get_tree().edited_scene_root.filename)
  39.  
  40. ProjectSettings.set("debug/settings/fps/force_fps", 30)
  41. ProjectSettings.set("rendering/environment/default_clear_color", bg_color)
  42.  
  43. print("Applied Navdi 2d project settings for '", project_name, "' viewed @ ", width, "x", height)
  44.  
RAW Paste Data