init project commit

This commit is contained in:
Pyral 2024-12-20 11:57:43 -05:00
commit 70be9e841f
16 changed files with 450 additions and 0 deletions

4
.editorconfig Normal file
View File

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
/android/

0
README.md Normal file
View File

7
assets/lemon_rest.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dkjl7bm26vj73"]
[ext_resource type="Texture2D" uid="uid://dxop0rrfbapnm" path="res://assets/lemons_sm.png" id="1_422dm"]
[resource]
atlas = ExtResource("1_422dm")
region = Rect2(62, 28, 244, 358)

7
assets/lemon_run.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://bulv5qhjhtsnv"]
[ext_resource type="Texture2D" uid="uid://dxop0rrfbapnm" path="res://assets/lemons_sm.png" id="1_4y0px"]
[resource]
atlas = ExtResource("1_4y0px")
region = Rect2(357, 139, 336, 242)

BIN
assets/lemons_sm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dxop0rrfbapnm"
path="res://.godot/imported/lemons_sm.png-245c00cbce7506f2937ff499b6f9ec17.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/lemons_sm.png"
dest_files=["res://.godot/imported/lemons_sm.png-245c00cbce7506f2937ff499b6f9ec17.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/miss.wav Normal file

Binary file not shown.

24
assets/miss.wav.import Normal file
View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://doh10c785c5fm"
path="res://.godot/imported/miss.wav-227376b3a42a02fb20d4279954cdc829.sample"
[deps]
source_file="res://assets/miss.wav"
dest_files=["res://.godot/imported/miss.wav-227376b3a42a02fb20d4279954cdc829.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

81
export_presets.cfg Normal file
View File

@ -0,0 +1,81 @@
[preset.0]
name="Linux"
platform="Linux"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../dino_tomato_builds/dino_tomato.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Linux (arm64)"
platform="Linux"
runnable=false
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../dino_tomato_builds/dino_tomato.arm64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="arm64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b6qs41hrkimvo"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

95
main.gd Normal file
View File

@ -0,0 +1,95 @@
extends Control
const PREFIX_LABELS := "[color=black]%s"
@export var images:Dictionary[StringName, Texture2D] = {
&"rest": preload("res://assets/lemon_rest.tres"),
&"longrest": preload("res://assets/lemon_rest.tres"),
&"run": preload("res://assets/lemon_run.tres")
}
@export var time_label:RichTextLabel
@export var realtime_label:RichTextLabel
@export var rest_label:RichTextLabel
@export var timer:Timer
@export var image:TextureRect
var context:PomodoroContext
var realtime_since_start:float = 0.0
@onready var sfx:AudioStreamPlayer = $SFX
@export var edits:Dictionary[StringName,TextEdit] = {}
class PomodoroContext:
var current_state := &"run"
var workmins:float = 25.0
var restmins:float = 10.0
var longrestmins:float = 30.0
var remaining_rests := 0
var initial_rests := 4
func _init(_rests:=4, _workmins:=25, _rest_mins:=10, _longrestmins:=30)->void:
self.workmins = _workmins
self.restmins = _rest_mins
self.longrestmins = _longrestmins
self.remaining_rests = _rests
self.initial_rests = _rests
self.current_state = &"run"
func get_state_timer(state:StringName)->float:
match(state):
&"run": return workmins * 60.0
&"rest": return restmins * 60.0
&"longrest": return longrestmins * 60.0
push_error("What did you even do.")
return 0.0 # you fucked up.
func increment_phase()->void:
match(current_state):
&"run":
remaining_rests -= 1
current_state = &"rest" \
if remaining_rests > 0 \
else &"longrest"
&"longrest":
# reset
remaining_rests = initial_rests
current_state = &"run"
&"rest":
current_state = &"run"
var state_id:StringName = &"rest"
func _process(delta: float) -> void:
if not context: return
time_label.text = PREFIX_LABELS % get_clock_string()
rest_label.text = PREFIX_LABELS % str(context.remaining_rests)
realtime_since_start += delta
realtime_label.text = "[color=red]%s" % \
Time.get_time_string_from_unix_time(realtime_since_start)
func get_from_menus()->PomodoroContext:
return PomodoroContext.new(
4,
int(edits[&"run"].text),
int(edits[&"rest"].text),
int(edits[&"longrest"].text))
func on_clock_start()->void:
realtime_since_start = 0.0
context = get_from_menus()
timer.start(context.get_state_timer(context.current_state))
image.texture = images[context.current_state]
func get_clock_string()->String:
return Time.get_time_string_from_unix_time(timer.time_left)
func _on_timeout() -> void:
context.increment_phase()
timer.start(context.get_state_timer(context.current_state))
image.texture = images[context.current_state]
sfx.play()

120
main.tscn Normal file
View File

@ -0,0 +1,120 @@
[gd_scene load_steps=3 format=3 uid="uid://dw6uk60j153g4"]
[ext_resource type="Script" path="res://main.gd" id="1_fn6k1"]
[ext_resource type="AudioStream" uid="uid://doh10c785c5fm" path="res://assets/miss.wav" id="3_sir8a"]
[node name="Main" type="Control" node_paths=PackedStringArray("time_label", "realtime_label", "rest_label", "timer", "image", "edits")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_fn6k1")
time_label = NodePath("Time")
realtime_label = NodePath("TotalTime")
rest_label = NodePath("Rests")
timer = NodePath("Timer")
image = NodePath("FunnyImg")
edits = {
&"rest": NodePath("VBoxContainer/EditMinutesBreak"),
&"run": NodePath("VBoxContainer/EditWorkMins"),
&"longrest": NodePath("VBoxContainer/EditMinutesLongBreak")
}
[node name="FunnyImg" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 13.0
offset_right = -141.0
offset_bottom = -37.0
grow_horizontal = 2
grow_vertical = 2
expand_mode = 1
stretch_mode = 4
[node name="ButtonStart" type="Button" parent="."]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -37.0
offset_right = 52.0
grow_vertical = 0
text = "Start"
[node name="Timer" type="Timer" parent="."]
[node name="Time" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -141.0
offset_top = -23.0
grow_horizontal = 0
grow_vertical = 0
size_flags_vertical = 3
bbcode_enabled = true
text = "[color=black]00:00:00"
horizontal_alignment = 2
[node name="TotalTime" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -141.0
offset_top = -23.0
grow_horizontal = 0
grow_vertical = 0
size_flags_vertical = 3
bbcode_enabled = true
text = "[color=black]00:00:00"
[node name="Rests" type="RichTextLabel" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
bbcode_enabled = true
text = "[color=black]4"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -141.0
grow_horizontal = 0
grow_vertical = 2
[node name="EditWorkMins" type="TextEdit" parent="VBoxContainer"]
layout_mode = 2
text = "25"
placeholder_text = "Work"
scroll_fit_content_height = true
[node name="EditMinutesBreak" type="TextEdit" parent="VBoxContainer"]
layout_mode = 2
text = "10"
placeholder_text = "Break"
scroll_fit_content_height = true
[node name="EditMinutesLongBreak" type="TextEdit" parent="VBoxContainer"]
layout_mode = 2
text = "25"
placeholder_text = "Long Break"
scroll_fit_content_height = true
[node name="SFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_sir8a")
[connection signal="button_up" from="ButtonStart" to="." method="on_clock_start"]
[connection signal="timeout" from="Timer" to="." method="_on_timeout"]

35
project.godot Normal file
View File

@ -0,0 +1,35 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="dino_tomato"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.4", "GL Compatibility")
run/max_fps=30
run/low_processor_mode=true
boot_splash/bg_color=Color(1, 1, 1, 1)
boot_splash/show_image=false
boot_splash/fullsize=false
boot_splash/use_filter=false
config/icon="res://icon.svg"
[display]
window/size/viewport_width=256
window/size/viewport_height=140
window/size/resizable=false
window/energy_saving/keep_screen_on=false
window/vsync/vsync_mode=0
[rendering]
renderer/rendering_method="mobile"
environment/defaults/default_clear_color=Color(1, 1, 1, 1)