aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date_picker/date_picker.tscn147
-rw-r--r--date_picker/scroll_picker.gd118
-rw-r--r--export_presets.cfg6
-rw-r--r--main.tscn66
-rw-r--r--project.godot4
5 files changed, 319 insertions, 22 deletions
diff --git a/date_picker/date_picker.tscn b/date_picker/date_picker.tscn
new file mode 100644
index 0000000..88f98d8
--- /dev/null
+++ b/date_picker/date_picker.tscn
@@ -0,0 +1,147 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://date_picker/scroll_picker.gd" type="Script" id=1]
+
+[node name="date_picker" type="HBoxContainer"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
+alignment = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="day_scroll" type="Control" parent="."]
+margin_left = 5.0
+margin_right = 239.0
+margin_bottom = 1280.0
+rect_min_size = Vector2( 234, 0 )
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="label" type="Label" parent="day_scroll"]
+anchor_right = 1.0
+text = "day"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_previous" type="Label" parent="day_scroll"]
+anchor_right = 1.0
+margin_bottom = 80.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value" type="Label" parent="day_scroll"]
+anchor_right = 1.0
+margin_top = 80.0
+margin_bottom = 160.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_next" type="Label" parent="day_scroll"]
+anchor_right = 1.0
+margin_top = 160.0
+margin_bottom = 240.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="month_scroll" type="Control" parent="."]
+margin_left = 243.0
+margin_right = 477.0
+margin_bottom = 1280.0
+rect_min_size = Vector2( 234, 0 )
+script = ExtResource( 1 )
+
+[node name="label" type="Label" parent="month_scroll"]
+anchor_right = 1.0
+text = "month"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_previous" type="Label" parent="month_scroll"]
+anchor_right = 1.0
+margin_bottom = 80.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value" type="Label" parent="month_scroll"]
+anchor_right = 1.0
+margin_top = 80.0
+margin_bottom = 160.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_next" type="Label" parent="month_scroll"]
+anchor_right = 1.0
+margin_top = 160.0
+margin_bottom = 240.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="year_scroll" type="Control" parent="."]
+margin_left = 481.0
+margin_right = 715.0
+margin_bottom = 1280.0
+rect_min_size = Vector2( 234, 0 )
+script = ExtResource( 1 )
+
+[node name="label" type="Label" parent="year_scroll"]
+anchor_right = 1.0
+text = "year"
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_previous" type="Label" parent="year_scroll"]
+anchor_right = 1.0
+margin_bottom = 80.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value" type="Label" parent="year_scroll"]
+anchor_right = 1.0
+margin_top = 80.0
+margin_bottom = 160.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="value_next" type="Label" parent="year_scroll"]
+anchor_right = 1.0
+margin_top = 160.0
+margin_bottom = 240.0
+mouse_filter = 1
+align = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
diff --git a/date_picker/scroll_picker.gd b/date_picker/scroll_picker.gd
new file mode 100644
index 0000000..ba70084
--- /dev/null
+++ b/date_picker/scroll_picker.gd
@@ -0,0 +1,118 @@
+extends Control
+
+const MAX_POINTERS = 10
+
+var pointer: Dictionary
+var value: float = 0.0
+var anchor: float = 0.0
+var pointer_id: int = -1
+var start_pos: float = 0.0
+var pos: float = 0.0
+
+
+func _ready():
+ pointer = {
+ index = -1,
+ initial_position = Vector2.ZERO,
+ current_position = Vector2.ZERO,
+ relative = Vector2.ZERO,
+ velocity = Vector2.ZERO,
+ is_active = false,
+ timestamp = 0
+ }
+
+
+
+func _process(delta: float):
+# $label.text = "%s" % pointer.index
+ pointer.velocity *= clamp((1.0 - 5.5 * delta), 0.0, 1.0) # pow(1.0-0.995, delta)
+ if pointer.is_active:
+ value = anchor + (pointer.current_position.y - pointer.initial_position.y)
+ elif is_zero_approx(pointer.velocity.y) == false:
+ value += pointer.velocity.y * delta
+ if abs(pointer.velocity.y) < 50.0:
+ var max_value := 10
+ var scroll_unit_height := 80
+ var normalized_value := -value / scroll_unit_height
+ var normalized_int_value := round(normalized_value) as int
+ var logic_value := fposmod(normalized_int_value, max_value)
+ var fix := ((normalized_int_value as float) - normalized_value) * scroll_unit_height
+ value -= fix * 5.0 * delta
+
+# pointer.timestamp = OS.get_ticks_msec()
+# ($test as TextureRect).rect_global_position.y = value
+# $debug.text = "value: %s\nvelocity: %s\n%s" % [value, pointer.velocity, pointer.relative]
+ var current_pos = value
+ var turn_over := 800
+ if current_pos >= turn_over || current_pos < 0.0:
+ value = fposmod(current_pos, turn_over)
+# elif current_pos < 0:
+# value = 800 - current_pos
+
+
+ var max_value := 10
+ var scroll_unit_height := 40
+ var normalized_value := -value / scroll_unit_height
+ var normalized_int_value := round(normalized_value) as int
+ var logic_value := fposmod(normalized_int_value, max_value)
+ var logic_next_value := fposmod(normalized_int_value + 1, max_value)
+ var logic_previous_value := fposmod(normalized_int_value - 1, max_value)
+
+ var value_base_position := 140.0 # 180.0
+ var value_next_base_position := 180.0 # 260.0
+ var value_previous_base_position := 100.0
+
+ $value.text = "%d" % logic_value
+ $value_next.text = "%d" % logic_next_value
+ $value_previous.text = "%d" % logic_previous_value
+# $debug.text = "%s" % normalized_value
+
+ ($value as Label).rect_position.y = value_base_position - (normalized_value - normalized_int_value) * scroll_unit_height
+ ($value_previous as Label).rect_position.y = value_previous_base_position - (normalized_value - normalized_int_value) * scroll_unit_height
+ ($value_next as Label).rect_position.y = value_next_base_position - (normalized_value - normalized_int_value) * scroll_unit_height
+
+# ($value as Label).modulate.a = (scroll_unit_height - (normalized_value - normalized_int_value) * scroll_unit_height) / (scroll_unit_height as float)
+# $debug.text = "%s ..." % [normalized_int_value - normalized_value]
+ ($value_next as Label).modulate.a = ((normalized_value - normalized_int_value) + 0.5)
+ ($value_previous as Label).modulate.a = ((normalized_int_value - normalized_value) + 0.5)
+# ($value_previous as Label).modulate.a = ((normalized_value + normalized_int_value) * scroll_unit_height) / (scroll_unit_height as float)
+#
+#func _input(event: InputEvent):
+# $log.text += "> input: %s\n" % event.to_string()
+# if event is InputEventScreenTouch && event.pressed == false:
+# pointer.index = -1
+
+func _gui_input(event: InputEvent):
+# get_tree().set_input_as_handled()
+# if event is InputEventScreenTouch && event.pressed == false:
+# $label.text = "AUTCH"
+# $log.text += "> event: %s\n" % event.to_string()
+
+ if event is InputEventScreenTouch:
+# if (event is InputEventScreenTouch && pointer.is_active && pointer.index == event.index
+# || event is InputEventScreenTouch && pointer.is_active == false):
+ var touch := event as InputEventScreenTouch
+ pointer.is_active = event.pressed
+ pointer.current_position = touch.position
+ var time := OS.get_ticks_msec()
+ if pointer.is_active:
+ pointer.index = touch.index
+ pointer.initial_position = touch.position
+ anchor = value
+ else:
+ pointer.index = -1
+# elif abs(pointer.timestamp - time) > 50.0:
+# pointer.velocity = Vector2.ZERO
+# if pointer.is_active == false:
+# $output.text += "%10d: touch %d\n" % [abs(pointer.timestamp - time), touch.index]
+
+ if event is InputEventScreenDrag: # && pointer.index == event.index:
+ var drag := event as InputEventScreenDrag
+ pointer.current_position = drag.position
+ pointer.velocity = drag.speed
+# $label.text = "%s"%drag.speed
+ pointer.relative = drag.relative
+ pointer.timestamp = OS.get_ticks_msec()
+# $output.text += "%10d: drag %d\n" % [pointer.timestamp, drag.index]
+
+
diff --git a/export_presets.cfg b/export_presets.cfg
index 468f32f..5c563c9 100644
--- a/export_presets.cfg
+++ b/export_presets.cfg
@@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="../builds/test.apk"
+export_path="../builds/test_pico_debug.apk"
script_export_mode=1
script_encryption_key=""
@@ -27,7 +27,7 @@ keystore/debug_password="debug.password"
keystore/release=""
keystore/release_user=""
keystore/release_password=""
-one_click_deploy/clear_previous_install=false
+one_click_deploy/clear_previous_install=true
version/code=1
version/name="1.0"
package/unique_name="com.gudinoff.$genname"
@@ -42,7 +42,7 @@ graphics/32_bits_framebuffer=true
graphics/opengl_debug=false
xr_features/xr_mode=0
xr_features/hand_tracking=0
-screen/immersive_mode=true
+screen/immersive_mode=false
screen/support_small=true
screen/support_normal=true
screen/support_large=true
diff --git a/main.tscn b/main.tscn
index 16e73df..c3a8f2b 100644
--- a/main.tscn
+++ b/main.tscn
@@ -1,107 +1,119 @@
-[gd_scene load_steps=2 format=2]
+[gd_scene load_steps=3 format=2]
[ext_resource path="res://main.gd" type="Script" id=1]
+[ext_resource path="res://date_picker/date_picker.tscn" type="PackedScene" id=2]
[node name="main" type="Node"]
-[node name="ScrollContainer" type="ScrollContainer" parent="."]
+[node name="TabContainer" type="TabContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 4.0
+margin_top = 32.0
+margin_right = -4.0
+margin_bottom = -4.0
scroll_horizontal_enabled = false
__meta__ = {
"_edit_use_anchors_": false
}
-[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
+[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/ScrollContainer"]
margin_right = 720.0
margin_bottom = 548.0
rect_min_size = Vector2( 720, 0 )
rect_clip_content = true
script = ExtResource( 1 )
-[node name="process_number" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="process_number" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_right = 720.0
margin_bottom = 24.0
placeholder_text = "Nº Processo"
caret_blink = true
-[node name="surgery_number" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="surgery_number" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 28.0
margin_right = 720.0
margin_bottom = 52.0
placeholder_text = "Nº Cirurgia"
caret_blink = true
-[node name="place" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="place" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 56.0
margin_right = 720.0
margin_bottom = 80.0
placeholder_text = "Local"
caret_blink = true
-[node name="anesthesia" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="anesthesia" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 84.0
margin_right = 720.0
margin_bottom = 108.0
placeholder_text = "Anesthesics"
caret_blink = true
-[node name="first_aider" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="first_aider" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 112.0
margin_right = 720.0
margin_bottom = 136.0
placeholder_text = "1º Ajudante"
caret_blink = true
-[node name="type" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 140.0
margin_right = 720.0
margin_bottom = 164.0
placeholder_text = "Tipo"
caret_blink = true
-[node name="sub_type" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="sub_type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 168.0
margin_right = 720.0
margin_bottom = 192.0
placeholder_text = "Subtipo"
caret_blink = true
-[node name="sub_sub_type" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="sub_sub_type" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 196.0
margin_right = 720.0
margin_bottom = 220.0
placeholder_text = "Sub-Subtipo"
caret_blink = true
-[node name="pathology" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="pathology" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 224.0
margin_right = 720.0
margin_bottom = 248.0
placeholder_text = "Patologia"
caret_blink = true
-[node name="intervention" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="intervention" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 252.0
margin_right = 720.0
margin_bottom = 276.0
placeholder_text = "Intervenção"
caret_blink = true
-[node name="urgency" type="CheckBox" parent="ScrollContainer/VBoxContainer"]
+[node name="urgency" type="CheckBox" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 280.0
margin_right = 720.0
margin_bottom = 304.0
text = "Urgência"
-[node name="notes" type="LineEdit" parent="ScrollContainer/VBoxContainer"]
+[node name="notes" type="LineEdit" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 308.0
margin_right = 720.0
margin_bottom = 332.0
placeholder_text = "Notas"
caret_blink = true
-[node name="output" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"]
+[node name="output" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 336.0
margin_right = 720.0
margin_bottom = 386.0
@@ -110,7 +122,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="timer" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"]
+[node name="timer" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 390.0
margin_right = 720.0
margin_bottom = 440.0
@@ -119,7 +131,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="button" type="Button" parent="ScrollContainer/VBoxContainer"]
+[node name="button" type="Button" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 444.0
margin_right = 720.0
margin_bottom = 494.0
@@ -131,7 +143,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
-[node name="log" type="RichTextLabel" parent="ScrollContainer/VBoxContainer"]
+[node name="log" type="RichTextLabel" parent="TabContainer/ScrollContainer/VBoxContainer"]
margin_top = 498.0
margin_right = 720.0
margin_bottom = 548.0
@@ -139,3 +151,19 @@ rect_min_size = Vector2( 0, 50 )
__meta__ = {
"_edit_use_anchors_": false
}
+
+[node name="ScrollContainer2" type="ScrollContainer" parent="TabContainer"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 4.0
+margin_top = 32.0
+margin_right = -4.0
+margin_bottom = -4.0
+
+[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/ScrollContainer2"]
+margin_right = 710.0
+
+[node name="date_picker" parent="TabContainer/ScrollContainer2/VBoxContainer" instance=ExtResource( 2 )]
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 710.0
diff --git a/project.godot b/project.godot
index 8bc4dca..fa00ba4 100644
--- a/project.godot
+++ b/project.godot
@@ -25,6 +25,10 @@ window/size/height=1280
window/energy_saving/keep_screen_on=false
window/handheld/orientation="portrait"
+[input_devices]
+
+pointing/emulate_touch_from_mouse=true
+
[physics]
common/enable_pause_aware_picking=true