graphics_tablet_input.tscn 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. [gd_scene load_steps=13 format=3 uid="uid://dxpettbof8pr8"]
  2. [ext_resource type="Script" uid="uid://c8j1v1pxecy0q" path="res://graphics_tablet_input.gd" id="1_fhuxi"]
  3. [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0pp2f"]
  4. content_margin_left = 12.0
  5. content_margin_top = 12.0
  6. content_margin_right = 12.0
  7. content_margin_bottom = 12.0
  8. bg_color = Color(0.223529, 0.223529, 0.223529, 1)
  9. [sub_resource type="InputEventAction" id="InputEventAction_spbge"]
  10. action = &"undo_last_line"
  11. [sub_resource type="Shortcut" id="Shortcut_3mcds"]
  12. events = [SubResource("InputEventAction_spbge")]
  13. [sub_resource type="InputEventAction" id="InputEventAction_7n722"]
  14. action = &"clear_all_lines"
  15. [sub_resource type="Shortcut" id="Shortcut_5wv4g"]
  16. events = [SubResource("InputEventAction_7n722")]
  17. [sub_resource type="InputEventAction" id="InputEventAction_y8lr1"]
  18. action = &"change_line_color"
  19. [sub_resource type="Shortcut" id="Shortcut_1nmmy"]
  20. events = [SubResource("InputEventAction_y8lr1")]
  21. [sub_resource type="InputEventAction" id="InputEventAction_0l3by"]
  22. action = &"toggle_pressure_sensitive"
  23. [sub_resource type="Shortcut" id="Shortcut_mnr5q"]
  24. events = [SubResource("InputEventAction_0l3by")]
  25. [sub_resource type="InputEventAction" id="InputEventAction_4p65y"]
  26. action = &"toggle_tilt_vector"
  27. [sub_resource type="Shortcut" id="Shortcut_231fk"]
  28. events = [SubResource("InputEventAction_4p65y")]
  29. [node name="ColorRect" type="ColorRect"]
  30. anchors_preset = 15
  31. anchor_right = 1.0
  32. anchor_bottom = 1.0
  33. grow_horizontal = 2
  34. grow_vertical = 2
  35. mouse_default_cursor_shape = 3
  36. script = ExtResource("1_fhuxi")
  37. [node name="CanvasLayer" type="CanvasLayer" parent="."]
  38. [node name="PanelContainer" type="PanelContainer" parent="CanvasLayer"]
  39. offset_right = 264.0
  40. offset_bottom = 648.0
  41. size_flags_horizontal = 0
  42. theme_override_styles/panel = SubResource("StyleBoxFlat_0pp2f")
  43. [node name="Options" type="VBoxContainer" parent="CanvasLayer/PanelContainer"]
  44. custom_minimum_size = Vector2(240, 0)
  45. layout_mode = 2
  46. size_flags_horizontal = 0
  47. theme_override_constants/separation = 10
  48. [node name="UndoLastLine" type="Button" parent="CanvasLayer/PanelContainer/Options"]
  49. unique_name_in_owner = true
  50. layout_mode = 2
  51. disabled = true
  52. shortcut = SubResource("Shortcut_3mcds")
  53. text = "Undo Last Line"
  54. [node name="ClearAllLines" type="Button" parent="CanvasLayer/PanelContainer/Options"]
  55. unique_name_in_owner = true
  56. layout_mode = 2
  57. disabled = true
  58. shortcut = SubResource("Shortcut_5wv4g")
  59. text = "Clear All Lines"
  60. [node name="HSeparator" type="HSeparator" parent="CanvasLayer/PanelContainer/Options"]
  61. layout_mode = 2
  62. [node name="LineColor" type="HBoxContainer" parent="CanvasLayer/PanelContainer/Options"]
  63. layout_mode = 2
  64. theme_override_constants/separation = 10
  65. [node name="Label" type="Label" parent="CanvasLayer/PanelContainer/Options/LineColor"]
  66. layout_mode = 2
  67. text = "Line Color"
  68. [node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasLayer/PanelContainer/Options/LineColor"]
  69. custom_minimum_size = Vector2(0, 30)
  70. layout_mode = 2
  71. size_flags_horizontal = 3
  72. shortcut = SubResource("Shortcut_1nmmy")
  73. [node name="LineWidth" type="HBoxContainer" parent="CanvasLayer/PanelContainer/Options"]
  74. layout_mode = 2
  75. tooltip_text = "(-: Decrease, +: Increase)"
  76. theme_override_constants/separation = 10
  77. [node name="Label" type="Label" parent="CanvasLayer/PanelContainer/Options/LineWidth"]
  78. layout_mode = 2
  79. text = "Line Width"
  80. [node name="HSlider" type="HSlider" parent="CanvasLayer/PanelContainer/Options/LineWidth"]
  81. layout_mode = 2
  82. size_flags_horizontal = 3
  83. size_flags_vertical = 4
  84. min_value = 0.5
  85. max_value = 20.0
  86. step = 0.5
  87. value = 3.0
  88. [node name="Value" type="Label" parent="CanvasLayer/PanelContainer/Options/LineWidth"]
  89. custom_minimum_size = Vector2(35, 0)
  90. layout_mode = 2
  91. text = "3.0"
  92. horizontal_alignment = 1
  93. [node name="PressureSensitive" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
  94. layout_mode = 2
  95. tooltip_text = "If enabled, modulates line width according to pen pressure.
  96. This has no effect if drawing with a mouse or a tablet
  97. without pen pressure support."
  98. button_pressed = true
  99. shortcut = SubResource("Shortcut_mnr5q")
  100. text = "Pressure-Sensitive"
  101. [node name="ShowTiltVector" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
  102. layout_mode = 2
  103. tooltip_text = "If enabled, shows a visual representation of the tilt vector
  104. reported by the graphics tablet. Tilt is not supported by all
  105. graphics tablets."
  106. button_pressed = true
  107. shortcut = SubResource("Shortcut_231fk")
  108. text = "Show Tilt Vector"
  109. [node name="HSeparator2" type="HSeparator" parent="CanvasLayer/PanelContainer/Options"]
  110. layout_mode = 2
  111. [node name="MSAA" type="HBoxContainer" parent="CanvasLayer/PanelContainer/Options"]
  112. layout_mode = 2
  113. theme_override_constants/separation = 10
  114. [node name="Label" type="Label" parent="CanvasLayer/PanelContainer/Options/MSAA"]
  115. layout_mode = 2
  116. text = "MSAA 2D"
  117. [node name="OptionButton" type="OptionButton" parent="CanvasLayer/PanelContainer/Options/MSAA"]
  118. layout_mode = 2
  119. selected = 3
  120. item_count = 4
  121. popup/item_0/text = "Disabled"
  122. popup/item_1/text = "2×"
  123. popup/item_1/id = 1
  124. popup/item_2/text = "4×"
  125. popup/item_2/id = 2
  126. popup/item_3/text = "8×"
  127. popup/item_3/id = 3
  128. [node name="MaxFPS" type="HBoxContainer" parent="CanvasLayer/PanelContainer/Options"]
  129. layout_mode = 2
  130. theme_override_constants/separation = 10
  131. [node name="Label" type="Label" parent="CanvasLayer/PanelContainer/Options/MaxFPS"]
  132. layout_mode = 2
  133. text = "Max FPS"
  134. [node name="HSlider" type="HSlider" parent="CanvasLayer/PanelContainer/Options/MaxFPS"]
  135. layout_mode = 2
  136. size_flags_horizontal = 3
  137. size_flags_vertical = 4
  138. min_value = 10.0
  139. max_value = 240.0
  140. step = 5.0
  141. value = 145.0
  142. [node name="Value" type="Label" parent="CanvasLayer/PanelContainer/Options/MaxFPS"]
  143. custom_minimum_size = Vector2(35, 0)
  144. layout_mode = 2
  145. text = "145"
  146. horizontal_alignment = 1
  147. [node name="VSync" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
  148. layout_mode = 2
  149. tooltip_text = "Disable V-Sync to achieve lower input latency.
  150. Note that Android, iOS and Web platforms enforce
  151. V-Sync at a system level with no reliable way to disable it."
  152. text = "V-Sync"
  153. [node name="InputAccumulation" type="CheckButton" parent="CanvasLayer/PanelContainer/Options"]
  154. layout_mode = 2
  155. tooltip_text = "If enabled, inputs are collected and merged into a single input event on every rendered frame.
  156. By default, this is enabled in Godot, but this project disables it by default.
  157. This should be left disabled for drawing apps that expect precise input,
  158. as lines can become visibly jagged otherwise."
  159. text = "Input Accumulation"
  160. [node name="Spacer" type="Control" parent="CanvasLayer/PanelContainer/Options"]
  161. layout_mode = 2
  162. size_flags_vertical = 3
  163. [node name="TabletInfo" type="Label" parent="CanvasLayer/PanelContainer/Options"]
  164. unique_name_in_owner = true
  165. modulate = Color(1, 1, 1, 0.67451)
  166. layout_mode = 2
  167. text = "Pressure: 0.000
  168. Tilt: (0.000, 0.000)
  169. Inverted pen: No"
  170. [node name="TabletDriver" type="Label" parent="CanvasLayer/PanelContainer/Options"]
  171. unique_name_in_owner = true
  172. modulate = Color(1, 1, 1, 0.501961)
  173. layout_mode = 2
  174. text = "Tablet driver: <driver>"
  175. [connection signal="pressed" from="CanvasLayer/PanelContainer/Options/UndoLastLine" to="." method="_on_undo_last_line_pressed"]
  176. [connection signal="pressed" from="CanvasLayer/PanelContainer/Options/ClearAllLines" to="." method="_on_clear_all_lines_pressed"]
  177. [connection signal="color_changed" from="CanvasLayer/PanelContainer/Options/LineColor/ColorPickerButton" to="." method="_on_line_color_changed"]
  178. [connection signal="value_changed" from="CanvasLayer/PanelContainer/Options/LineWidth/HSlider" to="." method="_on_line_width_value_changed"]
  179. [connection signal="toggled" from="CanvasLayer/PanelContainer/Options/PressureSensitive" to="." method="_on_pressure_sensitive_toggled"]
  180. [connection signal="toggled" from="CanvasLayer/PanelContainer/Options/ShowTiltVector" to="." method="_on_show_tilt_vector_toggled"]
  181. [connection signal="item_selected" from="CanvasLayer/PanelContainer/Options/MSAA/OptionButton" to="." method="_on_msaa_item_selected"]
  182. [connection signal="value_changed" from="CanvasLayer/PanelContainer/Options/MaxFPS/HSlider" to="." method="_on_max_fps_value_changed"]
  183. [connection signal="toggled" from="CanvasLayer/PanelContainer/Options/VSync" to="." method="_on_v_sync_toggled"]
  184. [connection signal="toggled" from="CanvasLayer/PanelContainer/Options/InputAccumulation" to="." method="_on_input_accumulation_toggled"]