Skip to content

Commit

Permalink
refs #373: Update icons and add setup options to Sound Volumes compon…
Browse files Browse the repository at this point in the history
…ent.

Now devs can set if the Sound Volumens component should show the Master
bus only and if it should show the label with the name for each bus.

- **upd** Add custom icons for radio buttons in PopupMenu for the
  base_gui_theme.tres.
  • Loading branch information
mapedorr committed Jan 5, 2025
1 parent ab85e7a commit 13bd40c
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ extends GridContainer
const MIN_VOLUME := -30
const MUTE_VOLUME := -70

## Determines whether only the Master bus is displayed.
@export var show_master_only := false
## Specifies whether labels are displayed in front of each volume slider.
@export var show_labels := true

var dflt_volumes := {}


Expand Down Expand Up @@ -42,10 +47,15 @@ func _on_audio_manager_ready() -> void:
# Build sound settings UI
for bus_idx in range(AudioServer.get_bus_count()):
var bus_name := AudioServer.get_bus_name(bus_idx)
# Create the label for the slider
var label := Label.new()
label.text = bus_name
$ChannelsContainer.add_child(label)

if show_master_only and bus_idx > 0:
continue

if show_labels:
# Create the label for the slider
var label := Label.new()
label.text = bus_name
$ChannelsContainer.add_child(label)

# Create the node that will allow players to modify buses volumes
var slider = HSlider.new()
Expand Down
36 changes: 35 additions & 1 deletion addons/popochiu/engine/objects/gui/resources/base_gui_theme.tres
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_resource type="Theme" load_steps=20 format=3 uid="uid://dpequqav4rjaf"]
[gd_resource type="Theme" load_steps=29 format=3 uid="uid://dpequqav4rjaf"]

[ext_resource type="Texture2D" uid="uid://pl1ch71kfj72" path="res://addons/popochiu/engine/objects/gui/resources/images/check_button_checked.png" id="2_ldprq"]
[ext_resource type="Texture2D" uid="uid://dukr75slqli45" path="res://addons/popochiu/engine/objects/gui/resources/images/check_button_unchecked.png" id="3_3rprc"]
[ext_resource type="Texture2D" uid="uid://cqxqfxobqltga" path="res://addons/popochiu/engine/objects/gui/resources/images/grabber.png" id="4_4x0ix"]
[ext_resource type="Texture2D" uid="uid://bbl1rk1aqbhp" path="res://addons/popochiu/engine/objects/gui/resources/images/radio_button.png" id="5_c6xq1"]
[ext_resource type="Texture2D" uid="uid://d1ywqbehmtuv" path="res://addons/popochiu/engine/objects/gui/resources/images/down_arrow.png" id="5_jwcnu"]
[ext_resource type="FontFile" uid="uid://dm6h44ck2nm2b" path="res://addons/popochiu/engine/objects/gui/fonts/minecraftia-regular.ttf" id="6_gx6k1"]

Expand Down Expand Up @@ -58,6 +59,34 @@ thickness = 4
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_d8gde"]
bg_color = Color(0, 0, 0, 0.705882)

[sub_resource type="AtlasTexture" id="AtlasTexture_dg7lp"]
atlas = ExtResource("5_c6xq1")
region = Rect2(0, 0, 12, 12)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_m15gs"]
load_path = "res://.godot/imported/radio_button.png-f5f800afce88f7818a95c83aac5f8cc2.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_0o3te"]
atlas = SubResource("CompressedTexture2D_m15gs")
region = Rect2(12, 0, 12, 12)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_7ex1i"]
load_path = "res://.godot/imported/radio_button.png-f5f800afce88f7818a95c83aac5f8cc2.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_r2o0l"]
atlas = SubResource("CompressedTexture2D_7ex1i")
region = Rect2(24, 0, 12, 12)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_siucv"]
load_path = "res://.godot/imported/radio_button.png-f5f800afce88f7818a95c83aac5f8cc2.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_xd4wp"]
atlas = SubResource("CompressedTexture2D_siucv")
region = Rect2(36, 0, 12, 12)

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_effvh"]
bg_color = Color(0, 0, 0, 0.705882)

[resource]
default_font = ExtResource("6_gx6k1")
default_font_size = 8
Expand Down Expand Up @@ -86,3 +115,8 @@ HSlider/styles/grabber_area_highlight = SubResource("StyleBoxFlat_mp7ca")
HSlider/styles/slider = SubResource("StyleBoxLine_1vxxo")
OptionButton/icons/arrow = ExtResource("5_jwcnu")
PanelContainer/styles/panel = SubResource("StyleBoxFlat_d8gde")
PopupMenu/icons/radio_checked = SubResource("AtlasTexture_dg7lp")
PopupMenu/icons/radio_checked_disabled = SubResource("AtlasTexture_0o3te")
PopupMenu/icons/radio_unchecked = SubResource("AtlasTexture_r2o0l")
PopupMenu/icons/radio_unchecked_disabled = SubResource("AtlasTexture_xd4wp")
PopupMenu/styles/panel = SubResource("StyleBoxFlat_effvh")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func _ready() -> void:
text_speed.value = 0.1 - PopochiuUtils.e.text_speed
continue_mode.selected = 0 if PopochiuUtils.e.settings.auto_continue_text else 1
text_speed_label.text = "%.2fx" % PopochiuUtils.e.text_speed
continue_mode.get_popup().canvas_item_default_texture_filter =\
Viewport.DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST

# Connect to children signals
save.pressed.connect(_on_save_pressed)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,58 @@
[gd_scene load_steps=17 format=3 uid="uid://bmpxoiebdf67g"]
[gd_scene load_steps=19 format=3 uid="uid://bmpxoiebdf67g"]

[ext_resource type="PackedScene" uid="uid://c51xplyeuk787" path="res://addons/popochiu/engine/objects/gui/components/popups/popochiu_popup.tscn" id="1_l0ff4"]
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/gui/templates/simple_click/components/simple_click_settings_popup/simple_click_settings_popup.gd" id="2_y4ddu"]
[ext_resource type="Texture2D" uid="uid://bexxkrmqdiemq" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_save.png" id="3_iyxhd"]
[ext_resource type="Texture2D" uid="uid://0b0qq0lccphh" path="res://addons/popochiu/engine/objects/gui/templates/simple_click/components/simple_click_settings_popup/images/simple_click_settings_popup_icons.png" id="3_fhu7w"]
[ext_resource type="PackedScene" uid="uid://drx0r8w00ivck" path="res://addons/popochiu/engine/objects/gui/components/sound_volumes/sound_volumes.tscn" id="3_w0ss4"]
[ext_resource type="Texture2D" uid="uid://bns33w6nl2qkb" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_load.png" id="4_cxw13"]
[ext_resource type="Texture2D" uid="uid://bg1txcy1ofatq" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_dialog_history.png" id="5_8pumv"]
[ext_resource type="Texture2D" uid="uid://cxpcw7xvcjcfy" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_quit.png" id="6_o5sh3"]
[ext_resource type="Texture2D" uid="uid://cyvd8h2ouw8rg" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_audio.png" id="7_p3unk"]
[ext_resource type="Texture2D" uid="uid://hjol4hvanbt5" path="res://addons/popochiu/engine/objects/gui/components/settings_bar/images/btn_text.png" id="8_hh105"]

[sub_resource type="AtlasTexture" id="AtlasTexture_n1wdd"]
atlas = ExtResource("3_iyxhd")
atlas = ExtResource("3_fhu7w")
region = Rect2(0, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_2g267"]
atlas = ExtResource("4_cxw13")
region = Rect2(0, 0, 16, 16)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_bumy5"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_wplse"]
atlas = ExtResource("5_8pumv")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_wqqii"]
atlas = SubResource("CompressedTexture2D_bumy5")
region = Rect2(16, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_p5j1e"]
atlas = ExtResource("6_o5sh3")
region = Rect2(0, 0, 16, 16)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_wu5so"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_ktudv"]
atlas = ExtResource("7_p3unk")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_a4k08"]
atlas = SubResource("CompressedTexture2D_wu5so")
region = Rect2(32, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_ocfjj"]
atlas = ExtResource("8_hh105")
region = Rect2(0, 0, 16, 16)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_j70qy"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_c6y2c"]
atlas = SubResource("CompressedTexture2D_j70qy")
region = Rect2(48, 0, 16, 16)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_rtktt"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_454o7"]
atlas = SubResource("CompressedTexture2D_rtktt")
region = Rect2(64, 0, 16, 16)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_potjd"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_gnvye"]
atlas = SubResource("CompressedTexture2D_potjd")
region = Rect2(80, 0, 16, 16)

[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_kie24"]
load_path = "res://.godot/imported/simple_click_settings_popup_icons.png-4de2845c30a327fd59e4914b3d9bfaa1.ctex"

[sub_resource type="AtlasTexture" id="AtlasTexture_468g2"]
atlas = SubResource("CompressedTexture2D_kie24")
region = Rect2(96, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_1jlhx"]
atlas = ExtResource("8_hh105")
atlas = SubResource("AtlasTexture_468g2")
region = Rect2(0, 0, 16, 16)

[node name="SimpleClickSettingsPopup" instance=ExtResource("1_l0ff4")]
Expand Down Expand Up @@ -66,22 +83,22 @@ alignment = 0
unique_name_in_owner = true
layout_mode = 2
text = "Load"
icon = SubResource("AtlasTexture_2g267")
icon = SubResource("AtlasTexture_wqqii")
alignment = 0

[node name="History" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/LeftContainer" index="2"]
unique_name_in_owner = true
layout_mode = 2
text = "History"
icon = SubResource("AtlasTexture_wplse")
icon = SubResource("AtlasTexture_a4k08")
alignment = 0

[node name="Quit" type="Button" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/LeftContainer" index="3"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 10
text = "Quit"
icon = SubResource("AtlasTexture_p5j1e")
icon = SubResource("AtlasTexture_c6y2c")
alignment = 0

[node name="VSeparator" type="VSeparator" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer" index="1"]
Expand All @@ -103,10 +120,12 @@ layout_mode = 2
[node name="Icon" type="TextureRect" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/RightContainer/VolumeContainer/HBoxContainer" index="0"]
layout_mode = 2
size_flags_vertical = 4
texture = SubResource("AtlasTexture_ktudv")
texture = SubResource("AtlasTexture_454o7")

[node name="SoundVolumes" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/RightContainer/VolumeContainer/HBoxContainer" index="1" instance=ExtResource("3_w0ss4")]
layout_mode = 2
show_master_only = true
show_labels = false

[node name="ContinueContainer" type="VBoxContainer" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/RightContainer" index="1"]
layout_mode = 2
Expand All @@ -120,7 +139,7 @@ layout_mode = 2

[node name="Icon" type="TextureRect" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/RightContainer/ContinueContainer/HBoxContainer" index="0"]
layout_mode = 2
texture = SubResource("AtlasTexture_ocfjj")
texture = SubResource("AtlasTexture_gnvye")

[node name="ContinueMode" type="OptionButton" parent="Overlay/PanelContainer/VBoxContainer/BodyContainer/RightContainer/ContinueContainer/HBoxContainer" index="1"]
unique_name_in_owner = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extends PopochiuGraphicInterface
## inventory bar is in the top left corner of the screen, and the settings bar is in the top right
## corner of the screen.

@onready var settings_bar: Control = %SettingsBar
@onready var save_and_load_popup: Control = %SaveAndLoadPopup
@onready var text_settings_popup: Control = %TextSettingsPopup
@onready var sound_settings_popup: Control = %SoundSettingsPopup
Expand All @@ -18,9 +17,6 @@ extends PopochiuGraphicInterface
func _ready() -> void:
super()

# Connect to children's signals
settings_bar.option_selected.connect(_on_settings_option_selected)

# Connect to autoloads' signals
PopochiuUtils.cursor.replace_frames($Cursor)
PopochiuUtils.cursor.show_cursor()
Expand Down

0 comments on commit 13bd40c

Please sign in to comment.