Update to 8f32026364878ff37561c6bd6b3211ff1976a0d3

This commit is contained in:
JeremyStar™ 2024-05-15 00:58:51 +02:00
parent 4ecacaec90
commit 4ae26a0bdf
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
11 changed files with 231 additions and 2 deletions

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends EditorPlugin

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=3 format=3 uid="uid://7v3lokrljsjw"]
[ext_resource type="Script" path="res://addons/SUI/src/SuiProgressBar.gd" id="1_t211g"]
[ext_resource type="Theme" uid="uid://bfln8p0ov8enx" path="res://addons/SUI/themes/ProgressBar.tres" id="2_rvtjx"]
[node name="SuiProgressBar" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -1063.0
offset_bottom = -762.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_t211g")
editor_process = true
runtime_process = true
[node name="Bar" type="ProgressBar" parent="."]
layout_mode = 0
offset_right = 377.0
offset_bottom = 48.0
theme = ExtResource("2_rvtjx")
theme_override_font_sizes/font_size = 25
value = 50.0

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends Control
class_name SuiBaseClass

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass
@ -85,5 +101,5 @@ func update_element() -> void:
$Icon.axis_stretch_horizontal = as_horizontal
$Icon.axis_stretch_vertical = as_vertical
func update_pressed_state(is_pressed: bool) -> void:
func update_pressed(is_pressed: bool) -> void:
$Button.button_pressed = is_pressed

53
src/SuiProgressBar.gd Normal file
View file

@ -0,0 +1,53 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass
@export_category("Base Configuration")
## The size the percentage text should have.
@export var font_size: int = 25
@export_subgroup("ProgressBar")
## The minimum value this progress bar can display.
@export var minimum_value: float = 0.0
## The maximum value this progress bar can display.
@export var maximum_value: float = 100.0
## Forwarded from the internal [ProgressBar]. Will be overriden with the internal bar's value, any changes to this variable will not be reflected (except during [method _ready]).
@export var value: float = 50.0
## Determines if [code]value[/code] should be rounded to the nearest integer.
@export var rounded: bool = false
## See [member Range.exp_edit].
@export var exponential: bool = false
func _ready() -> void:
super()
if !in_editor(): $Bar.value = value
func update_element() -> void:
# Update sizes
$Bar.size = size
# Update ProgressBar stuff
$Bar.min_value = minimum_value
$Bar.max_value = maximum_value
$Bar.rounded = rounded
$Bar.exp_edit = exponential
if in_editor(): $Bar.value = value
else: value = $Bar.value
$Bar.add_theme_font_size_override("font_size", font_size)
func update_value(value_new: float) -> void:
$Bar.value = value_new

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
@tool
extends SuiBaseClass
@ -53,5 +69,5 @@ func update_element() -> void:
$Text.add_theme_font_size_override("bold_italics_font_size", font_size)
$Text.add_theme_font_size_override("mono_font_size", font_size)
func update_pressed_state(is_pressed: bool) -> void:
func update_pressed(is_pressed: bool) -> void:
$Button.button_pressed = is_pressed

View file

@ -1,3 +1,19 @@
# STAROPENSOURCE UI SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
extends Node
class_name SuiTypes

23
themes/ProgressBar.tres Normal file
View file

@ -0,0 +1,23 @@
[gd_resource type="Theme" load_steps=4 format=3 uid="uid://bfln8p0ov8enx"]
[ext_resource type="FontFile" uid="uid://d3cdnrnmplqa2" path="res://addons/SUI/fonts/Jost/Jost-Medium.ttf" id="1_5nv4j"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nesmb"]
bg_color = Color(0.997878, 0.337467, 0.369875, 1)
corner_radius_top_left = 8
corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1awnp"]
bg_color = Color(0.839216, 0.0196078, 0.196078, 1)
corner_radius_top_left = 8
corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8
[resource]
ProgressBar/colors/font_color = Color(1, 1, 1, 1)
ProgressBar/fonts/font = ExtResource("1_5nv4j")
ProgressBar/styles/background = SubResource("StyleBoxFlat_nesmb")
ProgressBar/styles/fill = SubResource("StyleBoxFlat_1awnp")