main.tscn 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. [gd_scene load_steps=7 format=3 uid="uid://1cywl1qtanq3"]
  2. [ext_resource type="Script" path="res://main.gd" id="1"]
  3. [ext_resource type="Texture2D" uid="uid://dnhldrc8cymrs" path="res://pixel_art_example.webp" id="2_mfq7n"]
  4. [ext_resource type="Texture2D" uid="uid://cok02ms2cxmut" path="res://pixel_art_text_example.webp" id="3_0qxym"]
  5. [ext_resource type="Texture2D" uid="uid://c43k4wledw7py" path="res://pixel_art_checkerboard_example.webp" id="3_unurd"]
  6. [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vvbdh"]
  7. draw_center = false
  8. border_width_left = 4
  9. border_width_top = 4
  10. border_width_right = 4
  11. border_width_bottom = 4
  12. border_color = Color(0.501961, 1, 0.25098, 0.501961)
  13. [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dyby4"]
  14. draw_center = false
  15. border_width_left = 8
  16. border_width_top = 8
  17. border_width_right = 8
  18. border_width_bottom = 8
  19. border_color = Color(0.25, 0.38, 0.8, 0.5)
  20. [node name="Main" type="Control"]
  21. layout_mode = 3
  22. anchors_preset = 15
  23. anchor_right = 1.0
  24. anchor_bottom = 1.0
  25. grow_horizontal = 2
  26. grow_vertical = 2
  27. script = ExtResource("1")
  28. [node name="OuterSideLabel" type="Label" parent="."]
  29. modulate = Color(1, 1, 1, 0.627451)
  30. layout_mode = 0
  31. offset_left = 8.0
  32. offset_top = 8.0
  33. offset_right = 165.0
  34. offset_bottom = 60.0
  35. text = "Outer Side Label
  36. (ignores all margins)"
  37. metadata/_edit_layout_mode = 1
  38. metadata/_edit_use_custom_anchors = false
  39. [node name="Panel" type="Panel" parent="."]
  40. layout_mode = 1
  41. anchors_preset = 15
  42. anchor_right = 1.0
  43. anchor_bottom = 1.0
  44. grow_horizontal = 2
  45. grow_vertical = 2
  46. theme_override_styles/panel = SubResource("StyleBoxFlat_vvbdh")
  47. [node name="InnerSideLabel" type="Label" parent="Panel"]
  48. modulate = Color(0.666667, 1, 0.501961, 1)
  49. layout_mode = 1
  50. anchors_preset = 2
  51. anchor_top = 1.0
  52. anchor_bottom = 1.0
  53. offset_left = 8.0
  54. offset_top = -60.0
  55. offset_right = 246.0
  56. offset_bottom = -8.0
  57. grow_vertical = 0
  58. text = "Inner Side Label
  59. (ignores GUI Max Aspect Ratio)"
  60. metadata/_edit_layout_mode = 1
  61. metadata/_edit_use_custom_anchors = false
  62. [node name="AspectRatioContainer" type="AspectRatioContainer" parent="Panel"]
  63. layout_mode = 1
  64. anchors_preset = 15
  65. anchor_right = 1.0
  66. anchor_bottom = 1.0
  67. grow_horizontal = 2
  68. grow_vertical = 2
  69. [node name="Panel" type="Panel" parent="Panel/AspectRatioContainer"]
  70. layout_mode = 2
  71. theme_override_styles/panel = SubResource("StyleBoxFlat_dyby4")
  72. [node name="TopLeft" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
  73. layout_mode = 0
  74. color = Color(1, 1, 1, 0.25098)
  75. [node name="TopRight" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
  76. layout_mode = 1
  77. anchors_preset = 1
  78. anchor_left = 1.0
  79. anchor_right = 1.0
  80. grow_horizontal = 0
  81. color = Color(1, 1, 1, 0.25098)
  82. [node name="BottomLeft" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
  83. layout_mode = 1
  84. anchors_preset = 2
  85. anchor_top = 1.0
  86. anchor_bottom = 1.0
  87. grow_vertical = 0
  88. color = Color(1, 1, 1, 0.25098)
  89. [node name="BottomRight" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
  90. layout_mode = 1
  91. anchors_preset = 3
  92. anchor_left = 1.0
  93. anchor_top = 1.0
  94. anchor_right = 1.0
  95. anchor_bottom = 1.0
  96. grow_horizontal = 0
  97. grow_vertical = 0
  98. color = Color(1, 1, 1, 0.25098)
  99. [node name="PixelArtExample" type="TextureRect" parent="Panel/AspectRatioContainer/Panel"]
  100. texture_filter = 1
  101. layout_mode = 1
  102. anchors_preset = 1
  103. anchor_left = 1.0
  104. anchor_right = 1.0
  105. offset_left = -88.0
  106. offset_top = 16.0
  107. offset_right = -56.0
  108. offset_bottom = 48.0
  109. grow_horizontal = 0
  110. texture = ExtResource("2_mfq7n")
  111. [node name="PixelArtExample2" type="TextureRect" parent="Panel/AspectRatioContainer/Panel"]
  112. texture_filter = 1
  113. layout_mode = 1
  114. anchors_preset = 1
  115. anchor_left = 1.0
  116. anchor_right = 1.0
  117. offset_left = -48.0
  118. offset_top = 16.0
  119. offset_right = -16.0
  120. offset_bottom = 48.0
  121. grow_horizontal = 0
  122. rotation = 0.785398
  123. pivot_offset = Vector2(16, 16)
  124. texture = ExtResource("2_mfq7n")
  125. [node name="PixelArtCheckerboardExample" type="TextureRect" parent="Panel/AspectRatioContainer/Panel"]
  126. modulate = Color(1, 1, 1, 0.752941)
  127. texture_filter = 1
  128. layout_mode = 1
  129. anchors_preset = 1
  130. anchor_left = 1.0
  131. anchor_right = 1.0
  132. offset_left = -136.0
  133. offset_top = 16.0
  134. offset_right = -104.0
  135. offset_bottom = 48.0
  136. grow_horizontal = 0
  137. texture = ExtResource("3_unurd")
  138. [node name="PixelArtTextExample" type="TextureRect" parent="Panel/AspectRatioContainer/Panel"]
  139. texture_filter = 1
  140. layout_mode = 1
  141. anchors_preset = 1
  142. anchor_left = 1.0
  143. anchor_right = 1.0
  144. offset_left = -215.0
  145. offset_top = 56.0
  146. offset_right = -16.0
  147. offset_bottom = 75.0
  148. grow_horizontal = 0
  149. texture = ExtResource("3_0qxym")
  150. [node name="CenterContainer" type="CenterContainer" parent="Panel/AspectRatioContainer/Panel"]
  151. layout_mode = 1
  152. anchors_preset = 15
  153. anchor_right = 1.0
  154. anchor_bottom = 1.0
  155. grow_horizontal = 2
  156. grow_vertical = 2
  157. [node name="Options" type="VBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer"]
  158. layout_mode = 2
  159. theme_override_constants/separation = 10
  160. [node name="Title" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  161. layout_mode = 2
  162. theme_override_colors/font_color = Color(1, 0.87, 0.62, 1)
  163. theme_override_font_sizes/font_size = 24
  164. text = "Options"
  165. horizontal_alignment = 1
  166. [node name="WindowBaseSize" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  167. layout_mode = 2
  168. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize"]
  169. custom_minimum_size = Vector2(220, 0)
  170. layout_mode = 2
  171. text = "Window Base Size"
  172. [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize"]
  173. layout_mode = 2
  174. size_flags_horizontal = 3
  175. item_count = 8
  176. selected = 0
  177. popup/item_0/text = "648×648 (1:1)"
  178. popup/item_0/id = 0
  179. popup/item_1/text = "640×480 (4:3)"
  180. popup/item_1/id = 1
  181. popup/item_2/text = "720×480 (3:2)"
  182. popup/item_2/id = 2
  183. popup/item_3/text = "800×600 (4:3)"
  184. popup/item_3/id = 3
  185. popup/item_4/text = "1152×648 (16:9)"
  186. popup/item_4/id = 4
  187. popup/item_5/text = "1280×720 (16:9)"
  188. popup/item_5/id = 5
  189. popup/item_6/text = "1280×800 (16:10)"
  190. popup/item_6/id = 6
  191. popup/item_7/text = "1680×720 (21:9)"
  192. popup/item_7/id = 7
  193. [node name="WindowStretchMode" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  194. layout_mode = 2
  195. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode"]
  196. custom_minimum_size = Vector2(220, 0)
  197. layout_mode = 2
  198. text = "Window Stretch Mode"
  199. [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode"]
  200. layout_mode = 2
  201. size_flags_horizontal = 3
  202. item_count = 3
  203. selected = 1
  204. popup/item_0/text = "Disabled"
  205. popup/item_0/id = 0
  206. popup/item_1/text = "Canvas Items (2D)"
  207. popup/item_1/id = 1
  208. popup/item_2/text = "Viewport"
  209. popup/item_2/id = 2
  210. [node name="WindowStretchAspect" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  211. layout_mode = 2
  212. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect"]
  213. custom_minimum_size = Vector2(220, 0)
  214. layout_mode = 2
  215. text = "Window Stretch Aspect"
  216. [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect"]
  217. layout_mode = 2
  218. size_flags_horizontal = 3
  219. item_count = 5
  220. selected = 4
  221. popup/item_0/text = "Ignore"
  222. popup/item_0/id = 0
  223. popup/item_1/text = "Keep"
  224. popup/item_1/id = 1
  225. popup/item_2/text = "Keep Width"
  226. popup/item_2/id = 2
  227. popup/item_3/text = "Keep Height"
  228. popup/item_3/id = 3
  229. popup/item_4/text = "Expand"
  230. popup/item_4/id = 4
  231. [node name="WindowScaleFactor" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  232. layout_mode = 2
  233. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
  234. custom_minimum_size = Vector2(220, 0)
  235. layout_mode = 2
  236. text = "Window Scale Factor"
  237. [node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
  238. layout_mode = 2
  239. size_flags_horizontal = 3
  240. size_flags_stretch_ratio = 100.0
  241. min_value = 0.75
  242. max_value = 2.0
  243. step = 0.01
  244. value = 1.0
  245. [node name="Value" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
  246. layout_mode = 2
  247. size_flags_horizontal = 3
  248. text = "100%"
  249. [node name="WindowStretchScaleMode" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  250. layout_mode = 2
  251. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchScaleMode"]
  252. custom_minimum_size = Vector2(220, 0)
  253. layout_mode = 2
  254. text = "Window Stretch Scale Mode"
  255. [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchScaleMode"]
  256. layout_mode = 2
  257. size_flags_horizontal = 3
  258. item_count = 2
  259. selected = 0
  260. popup/item_0/text = "Fractional"
  261. popup/item_0/id = 0
  262. popup/item_1/text = "Integer"
  263. popup/item_1/id = 1
  264. [node name="HSeparator" type="HSeparator" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  265. layout_mode = 2
  266. [node name="GUIMaxAspectRatio" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  267. layout_mode = 2
  268. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio"]
  269. custom_minimum_size = Vector2(220, 0)
  270. layout_mode = 2
  271. text = "GUI Max Aspect Ratio"
  272. [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio"]
  273. layout_mode = 2
  274. size_flags_horizontal = 3
  275. item_count = 7
  276. selected = 0
  277. popup/item_0/text = "Fit to Window"
  278. popup/item_0/id = 0
  279. popup/item_1/text = "5:4"
  280. popup/item_1/id = 1
  281. popup/item_2/text = "4:3"
  282. popup/item_2/id = 2
  283. popup/item_3/text = "3:2"
  284. popup/item_3/id = 3
  285. popup/item_4/text = "16:10"
  286. popup/item_4/id = 4
  287. popup/item_5/text = "16:9"
  288. popup/item_5/id = 5
  289. popup/item_6/text = "21:9"
  290. popup/item_6/id = 6
  291. [node name="GUIMargin" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
  292. layout_mode = 2
  293. [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
  294. custom_minimum_size = Vector2(220, 0)
  295. layout_mode = 2
  296. text = "GUI Margin"
  297. [node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
  298. layout_mode = 2
  299. size_flags_horizontal = 3
  300. size_flags_stretch_ratio = 100.0
  301. max_value = 50.0
  302. [node name="Value" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
  303. layout_mode = 2
  304. size_flags_horizontal = 3
  305. text = "0"
  306. [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize/OptionButton" to="." method="_on_window_base_size_item_selected"]
  307. [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode/OptionButton" to="." method="_on_window_stretch_mode_item_selected"]
  308. [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect/OptionButton" to="." method="_on_window_stretch_aspect_item_selected"]
  309. [connection signal="drag_ended" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/HSlider" to="." method="_on_window_scale_factor_drag_ended"]
  310. [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchScaleMode/OptionButton" to="." method="_on_window_stretch_scale_mode_item_selected"]
  311. [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio/OptionButton" to="." method="_on_gui_aspect_ratio_item_selected"]
  312. [connection signal="drag_ended" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin/HSlider" to="." method="_on_gui_margin_drag_ended"]