diff --git a/godot/data/wellbeing_cards.csv b/data/wellbeing_cards.csv similarity index 100% rename from godot/data/wellbeing_cards.csv rename to data/wellbeing_cards.csv diff --git a/godot/data/wellbeings_cards.json b/godot/data/wellbeings_cards.json new file mode 100644 index 0000000..a7bd645 --- /dev/null +++ b/godot/data/wellbeings_cards.json @@ -0,0 +1,3 @@ +[ +{"id": "", "category": "", "title": "", "description": "", "picture_id": "", "audio_id": "", "language": ""} +] diff --git a/godot/icons/noun-fox-1043050.svg b/godot/icons/noun-fox-1043050.svg new file mode 100644 index 0000000..0addf2f --- /dev/null +++ b/godot/icons/noun-fox-1043050.svg @@ -0,0 +1 @@ +icons_animals_3 \ No newline at end of file diff --git a/godot/icons/noun-running-fox-4332379.svg b/godot/icons/noun-running-fox-4332379.svg new file mode 100644 index 0000000..0a8f59d --- /dev/null +++ b/godot/icons/noun-running-fox-4332379.svg @@ -0,0 +1 @@ +Artboard 14 \ No newline at end of file diff --git a/godot/main_screen.gd b/godot/main_screen.gd index 32119f8..876745a 100644 --- a/godot/main_screen.gd +++ b/godot/main_screen.gd @@ -1,12 +1,9 @@ -extends Node2D +extends CanvasLayer -onready var main_screen = get_node("/root/main_screen") -onready var start_menu = get_node("/root/main_screen/start_menu") -onready var user_menu = get_node("/root/main_screen/user_details") +onready var ui_control = get_node("/root/UiControl") onready var user_name = get_node("%textbox_user_name") onready var user_info = get_node("/root/UserValues") -onready var program_info = get_node("/root/ProgramValues") var config = ConfigFile.new() var err = config.load("user://user.ini") @@ -17,16 +14,12 @@ func _ready(): # otherwise set up new user data if err != OK: - start_menu.visible = false - user_menu.visible = true + ui_control.show_user_menu() else: # Set starting state visibility - - main_screen.visible = true - start_menu.visible = true - user_menu.visible = false + ui_control.show_start_menu() # define variables from ini file user_info.user_first_name = config.get_value("User", "user_name") diff --git a/godot/program_values.gd b/godot/program_values.gd index 38796ab..3bf189e 100644 --- a/godot/program_values.gd +++ b/godot/program_values.gd @@ -9,6 +9,10 @@ extends Node var release_version = 1 var web_release_version = 0 +var current_version = "Version 0.1" + +func check_update(): + pass func _ready(): pass diff --git a/godot/project.godot b/godot/project.godot index f64e457..819f902 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -12,12 +12,22 @@ config_version=4 config/name="Wellbeing App" run/main_scene="res://start_screen.tscn" +run/low_processor_mode=true config/icon="res://icon.png" [autoload] UserValues="*res://user_values.gd" ProgramValues="*res://program_values.gd" +UiControl="*res://ui_control.gd" + +[display] + +window/size/width=1280 +window/size/height=720 +window/energy_saving/keep_screen_on=false +window/stretch/mode="2d" +window/stretch/aspect="keep_height" [gui] diff --git a/godot/start_menu.gd b/godot/start_menu.gd index 875564f..42737c4 100644 --- a/godot/start_menu.gd +++ b/godot/start_menu.gd @@ -1,11 +1,13 @@ -extends Node2D +extends CanvasLayer onready var user_info = get_node("/root/UserValues") onready var program_info = get_node("/root/ProgramValues") + func _ready(): $HTTPRequest.connect("request_completed", self, "_on_request_completed") + $version_label.text = str(program_info.current_version) func _process(_delta): @@ -17,8 +19,9 @@ func _on_button_update_check_pressed(): func _on_HTTPRequest_request_completed(result, response_code, headers, body): -#func _on_request_completed(result, response_code, headers, body): var json = JSON.parse(body.get_string_from_utf8()) program_info.web_release_version = json.result if program_info.web_release_version > program_info.release_version: print("There's an update!") + elif program_info.web_release_version == program_info.release_version: + print("There is no update!") diff --git a/godot/start_screen.tscn b/godot/start_screen.tscn index 19ef95e..96fbcab 100644 --- a/godot/start_screen.tscn +++ b/godot/start_screen.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://main_screen.gd" type="Script" id=1] [ext_resource path="res://button_open_github.gd" type="Script" id=2] @@ -6,37 +6,68 @@ [ext_resource path="res://start_menu.gd" type="Script" id=4] [ext_resource path="res://button_name.gd" type="Script" id=5] [ext_resource path="res://button_user_save.gd" type="Script" id=6] +[ext_resource path="res://icons/noun-running-fox-4332379.svg" type="Texture" id=7] -[node name="main_screen" type="Node2D"] +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.862745, 0.435294, 0.329412, 1 ) +corner_radius_bottom_right = 45 + +[node name="main_screen" type="CanvasLayer"] script = ExtResource( 1 ) -__meta__ = { -"_edit_horizontal_guides_": [ ] -} -[node name="start_menu" type="Node2D" parent="."] +[node name="UI" type="CanvasLayer" parent="."] + +[node name="background_light" type="ColorRect" parent="UI"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.94902, 0.937255, 0.85098, 1 ) + +[node name="top_container" type="VBoxContainer" parent="UI"] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="top_bar" type="Panel" parent="UI/top_container"] +margin_right = 1280.0 +margin_bottom = 50.0 +rect_min_size = Vector2( 0, 50 ) +custom_styles/panel = SubResource( 1 ) + +[node name="Noun-running-fox-4332380" type="Sprite" parent="UI/top_container"] +position = Vector2( 54, 25 ) +texture = ExtResource( 7 ) + +[node name="start_menu" type="CanvasLayer" parent="."] script = ExtResource( 4 ) [node name="button_daily_action" type="Button" parent="start_menu"] -margin_left = 51.0 -margin_top = 75.0 -margin_right = 140.0 -margin_bottom = 95.0 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -75.5 +margin_top = -48.0 +margin_right = 75.5 +margin_bottom = -11.0 text = "Daily Action" [node name="welcome_title" type="RichTextLabel" parent="start_menu"] -margin_left = 19.0 -margin_top = 22.0 -margin_right = 1007.0 -margin_bottom = 53.0 +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -185.0 +margin_top = 11.0 +margin_right = 185.0 +margin_bottom = 42.0 text = "Good morning, Jaap! " scroll_active = false [node name="button_open_github" type="Button" parent="start_menu"] -margin_left = 98.0 -margin_top = 195.0 -margin_right = 135.0 -margin_bottom = 215.0 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -100.0 +margin_top = -37.0 text = "GitHub" script = ExtResource( 2 ) @@ -49,23 +80,34 @@ text = "Feedback" script = ExtResource( 3 ) [node name="button_name" type="Button" parent="start_menu"] -margin_left = 905.0 -margin_top = 19.0 -margin_right = 995.0 -margin_bottom = 56.0 +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -138.0 +margin_top = 6.0 +margin_right = -48.0 +margin_bottom = 43.0 text = "Name" script = ExtResource( 5 ) [node name="HTTPRequest" type="HTTPRequest" parent="start_menu"] [node name="button_update_check" type="Button" parent="start_menu"] -margin_left = 658.0 -margin_top = 354.0 -margin_right = 880.0 -margin_bottom = 391.0 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -222.0 +margin_top = -37.0 text = "Check for Updates" -[node name="user_details" type="Node2D" parent="."] +[node name="version_label" type="Label" parent="start_menu"] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_top = -25.0 +margin_right = 82.0 +text = "Version" + +[node name="user_details" type="CanvasLayer" parent="."] visible = false [node name="button_user_save" type="Button" parent="user_details"] @@ -82,6 +124,8 @@ margin_left = 244.0 margin_top = 205.0 margin_right = 794.0 margin_bottom = 250.0 +caret_blink = true +caret_blink_speed = 0.5 [node name="button_birth_day" type="MenuButton" parent="user_details"] margin_left = 311.0 diff --git a/godot/ui_control.gd b/godot/ui_control.gd new file mode 100644 index 0000000..703834d --- /dev/null +++ b/godot/ui_control.gd @@ -0,0 +1,24 @@ +extends Node + + +onready var main_screen = get_node("/root/main_screen") +onready var start_menu = get_node("/root/main_screen/start_menu") +onready var user_menu = get_node("/root/main_screen/user_details") + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +func show_start_menu(): + main_screen.visible = true + start_menu.visible = true + user_menu.visible = false + +func show_user_menu(): + main_screen.visible = true + start_menu.visible = false + user_menu.visible = true + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/notes/colour_scheme.png b/notes/colour_scheme.png new file mode 100644 index 0000000..ae5b751 Binary files /dev/null and b/notes/colour_scheme.png differ