Skip to content

Commit

Permalink
ADF-29 | fullscreen setting & display tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyTakinTeller committed Jul 13, 2024
1 parent 5ccc28d commit 62b6b8f
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 19 deletions.
4 changes: 3 additions & 1 deletion global/autoload/save_file/save_file.gd
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ func _on_offline_progress_processed(
_seconds_delta: int, _worker_progress: Dictionary, _enemy_progress: Dictionary, _factor: float
) -> void:
_autosave(true, true)
SignalBus.worker_updated.emit(Game.WORKER_RESOURCE_ID, workers[Game.WORKER_RESOURCE_ID], 0)
SignalBus.worker_updated.emit(
Game.WORKER_RESOURCE_ID, workers.get(Game.WORKER_RESOURCE_ID, 0), 0
)


##############
Expand Down
4 changes: 4 additions & 0 deletions global/autoload/signal_bus/signal_bus.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ signal deaths_door_open(enemy_data: EnemyData)
signal deaths_door(enemy_data: EnemyData, option: int)
signal audio_settings_update(toggle: bool, value: float, id: String)
signal effect_settings_update(toggle: bool, value: float, id: String)
signal display_mode_settings_toggle
signal display_resolution_settings_toggle

## CONTROLLER
signal main_ready
Expand Down Expand Up @@ -54,6 +56,8 @@ signal offline_progress_processed(
)
signal audio_settings_updated(toggle: bool, value: float, id: String)
signal effect_settings_updated(toggle: bool, value: float, id: String)
signal display_mode_settings_updated(display_mode: String)
signal display_resolution_settings_updated(width: int, height: int)

## MANAGER
signal resource_updated(id: String, total: int, amount: int, source_id: String)
Expand Down
2 changes: 1 addition & 1 deletion global/const/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const WORKER_ROLE_RESOURCE: Array[String] = [WORKER_RESOURCE_ID, "swordsman"]
const VERSION_MAJOR: String = "prototype"
const VERSION_MINOR: String = "week 11"

const PARAMS: Dictionary = PARAMS_PROD #PARAMS_PROD #PARAMS_DEBUG
const PARAMS: Dictionary = PARAMS_DEBUG #PARAMS_PROD #PARAMS_DEBUG

const PARAMS_DEBUG: Dictionary = {
"cycle_seconds": 2,
Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ window/size/viewport_width=960
window/size/viewport_height=540
window/size/window_width_override=960
window/size/window_height_override=540
window/stretch/mode="viewport"
window/stretch/mode="canvas_items"

[dotnet]

Expand Down
8 changes: 4 additions & 4 deletions resources/theme/dark/OpenSans-Regular.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
msdf_pixel_range=32
msdf_size=32
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
hinting=0
subpixel_positioning=0
oversampling=0.0
Fallbacks=null
fallbacks=[]
Expand Down
38 changes: 36 additions & 2 deletions resources/theme/dark/dark.tres
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,49 @@ cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/16/0/kerning_overrides/8/0 = Vector2(0, 0)
cache/0/16/0/kerning_overrides/32/0 = Vector2(0, 0)
cache/0/16/0/kerning_overrides/24/0 = Vector2(0, 0)
cache/0/16/0/kerning_overrides/64/0 = Vector2(0, 0)
cache/0/8/0/ascent = 0.0
cache/0/8/0/descent = 0.0
cache/0/8/0/underline_position = 0.0
cache/0/8/0/underline_thickness = 0.0
cache/0/8/0/scale = 1.0
cache/0/8/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/8/0/kerning_overrides/8/0 = Vector2(0, 0)
cache/0/8/0/kerning_overrides/32/0 = Vector2(0, 0)
cache/0/8/0/kerning_overrides/24/0 = Vector2(0, 0)
cache/0/8/0/kerning_overrides/64/0 = Vector2(0, 0)
cache/0/32/0/ascent = 0.0
cache/0/32/0/descent = 0.0
cache/0/32/0/underline_position = 0.0
cache/0/32/0/underline_thickness = 0.0
cache/0/32/0/scale = 1.0
cache/0/32/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/32/0/kerning_overrides/8/0 = Vector2(0, 0)
cache/0/32/0/kerning_overrides/32/0 = Vector2(0, 0)
cache/0/32/0/kerning_overrides/24/0 = Vector2(0, 0)
cache/0/32/0/kerning_overrides/64/0 = Vector2(0, 0)
cache/0/24/0/ascent = 0.0
cache/0/24/0/descent = 0.0
cache/0/24/0/underline_position = 0.0
cache/0/24/0/underline_thickness = 0.0
cache/0/24/0/scale = 1.0
cache/0/24/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/24/0/kerning_overrides/8/0 = Vector2(0, 0)
cache/0/24/0/kerning_overrides/32/0 = Vector2(0, 0)
cache/0/24/0/kerning_overrides/24/0 = Vector2(0, 0)
cache/0/24/0/kerning_overrides/64/0 = Vector2(0, 0)
cache/0/64/0/ascent = 0.0
cache/0/64/0/descent = 0.0
cache/0/64/0/underline_position = 0.0
cache/0/64/0/underline_thickness = 0.0
cache/0/64/0/scale = 1.0
cache/0/64/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/64/0/kerning_overrides/8/0 = Vector2(0, 0)
cache/0/64/0/kerning_overrides/32/0 = Vector2(0, 0)
cache/0/64/0/kerning_overrides/24/0 = Vector2(0, 0)
cache/0/64/0/kerning_overrides/64/0 = Vector2(0, 0)

[sub_resource type="AtlasTexture" id="22"]
atlas = ExtResource("2_plspm")
Expand Down Expand Up @@ -563,7 +599,6 @@ Button/colors/font_color_disabled = Color(0.9, 0.9, 0.9, 0.2)
Button/colors/font_color_hover = Color(0.94, 0.94, 0.94, 1)
Button/colors/font_color_pressed = Color(1, 1, 1, 1)
Button/constants/hseparation = 2
Button/fonts/font = ExtResource("1_cnjs4")
Button/styles/disabled = SubResource("StyleBoxFlat_1ymaf")
Button/styles/focus = SubResource("StyleBoxFlat_r5gq2")
Button/styles/hover = SubResource("StyleBoxFlat_5c4s2")
Expand Down Expand Up @@ -672,7 +707,6 @@ ProgressBar/styles/fill = SubResource("StyleBoxFlat_75tr5")
ProgressButton/base_type = &"Button"
ProgressButton/constants/h_separation = 4
ProgressButton/constants/hseparation = 2
ProgressButton/fonts/font = ExtResource("1_cnjs4")
ProgressButton/styles/disabled = SubResource("StyleBoxFlat_njrop")
ProgressButton/styles/focus = SubResource("StyleBoxFlat_0jagi")
ProgressButton/styles/hover = SubResource("StyleBoxFlat_hxxig")
Expand Down
9 changes: 9 additions & 0 deletions scenes/autostart/main/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ func _ready() -> void:
func _initialize() -> void:
tab_tracker.change_tab(0)

var display_mode: String = SaveFile.settings["display_mode"]
if display_mode == "fullscreen":
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, false)
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)


#############
## signals ##
Expand All @@ -34,8 +41,10 @@ func _connect_signals() -> void:
SignalBus.set_ui_theme.connect(_on_set_ui_theme)
self.ready.connect(_on_ready)


func _on_set_ui_theme(theme: Resource) -> void:
ui.theme = theme


func _on_ready() -> void:
SignalBus.main_ready.emit()
23 changes: 23 additions & 0 deletions scenes/controller/setting_controller/setting_controller.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func _connect_signals() -> void:
SignalBus.toggle_scale_pressed.connect(_on_toggle_scale_pressed)
SignalBus.audio_settings_update.connect(_on_audio_settings_update)
SignalBus.effect_settings_update.connect(_on_effect_settings_update)
SignalBus.display_mode_settings_toggle.connect(_on_display_mode_settings_toggle)
SignalBus.display_resolution_settings_toggle.connect(_on_display_resolution_settings_toggle)


func _on_toggle_button_pressed(id: String, toggle_id: String) -> void:
Expand All @@ -61,3 +63,24 @@ func _on_audio_settings_update(toggle: bool, value: float, id: String) -> void:

func _on_effect_settings_update(toggle: bool, value: float, id: String) -> void:
SignalBus.effect_settings_updated.emit(toggle, value, id)


func _on_display_mode_settings_toggle() -> void:
var display_mode: String = SaveFile.settings["display_mode"]
if display_mode == "windowed":
display_mode = "fullscreen"
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
display_mode = "windowed"
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, false)
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)

SignalBus.display_mode_settings_updated.emit(display_mode)


func _on_display_resolution_settings_toggle() -> void:
var width: int = SaveFile.settings["display_resolution"][0]
var height: int = SaveFile.settings["display_resolution"][1]
## TODO: replace resolution setting with a different one

SignalBus.display_resolution_settings_updated.emit(width, height)
10 changes: 10 additions & 0 deletions scenes/manager/setting_manager/setting_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ func _connect_signals() -> void:
SignalBus.toggle_scale.connect(_on_toggle_scale)
SignalBus.audio_settings_updated.connect(_on_audio_settings_updated)
SignalBus.effect_settings_updated.connect(_on_effect_settings_updated)
SignalBus.display_mode_settings_updated.connect(_on_display_mode_settings_updated)
SignalBus.display_resolution_settings_updated.connect(_on_display_resolution_settings_updated)


func _on_toggle_button(id: String, toggle_id: String) -> void:
Expand All @@ -37,3 +39,11 @@ func _on_audio_settings_updated(toggle: bool, value: float, id: String) -> void:
func _on_effect_settings_updated(toggle: bool, value: float, id: String) -> void:
SaveFile.effect_settings[id]["toggle"] = toggle
SaveFile.effect_settings[id]["value"] = value


func _on_display_mode_settings_updated(display_mode: String) -> void:
SaveFile.settings["display_mode"] = display_mode


func _on_display_resolution_settings_updated(width: int, height: int) -> void:
SaveFile.settings["display_resolution"] = [width, height]
5 changes: 4 additions & 1 deletion scenes/ui/npc_dialog/npc_dialog.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://bn70fimjb1ac0"]
[gd_scene load_steps=8 format=3 uid="uid://bn70fimjb1ac0"]

[ext_resource type="Script" path="res://scenes/ui/npc_dialog/npc_dialog.gd" id="1_urym8"]
[ext_resource type="Texture2D" uid="uid://cpwmy667e4xpa" path="res://assets/image/npc/cat/cat_90_100.png" id="2_8yoqs"]
[ext_resource type="PackedScene" uid="uid://ccm0lefdpacby" path="res://scenes/component/control/label/label_typing/label_typing.tscn" id="2_55et7"]
[ext_resource type="PackedScene" uid="uid://bpq246h5ihhck" path="res://scenes/component/shake_shader_component/shake_shader_component.tscn" id="3_uxbm3"]
[ext_resource type="PackedScene" uid="uid://b3awft3ugc6q3" path="res://scenes/component/tween/simple_tween/simple_tween.tscn" id="4_v2a86"]

[sub_resource type="ShaderMaterial" id="ShaderMaterial_32d3w"]
Expand Down Expand Up @@ -46,6 +47,8 @@ layout_mode = 2
size_flags_horizontal = 1
text = "I smelled you from a far. You look lost... "

[node name="ShakeShaderComponent" parent="MarginContainer/VBoxContainer/DialogMarginContainer/DialogLabel" instance=ExtResource("3_uxbm3")]

[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2

Expand Down
37 changes: 28 additions & 9 deletions scenes/ui/screen/settings_screen/settings_screen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ func _set_ui_labels() -> void:

display_mode_button.text = "?"
display_resolution_button.text = "?"
## TODO: replace resolution setting with a different one
display_resolution_button.disabled = true

## TODO: ADF-24 | Localization
display_language_button.text = Locale.LOCALE_NAME[SaveFile.locale]
display_language_button.disabled = true
## TODO: ADF-24 | Localization
display_language_button.disabled = true


func _apply_effects() -> void:
Expand Down Expand Up @@ -79,9 +81,9 @@ func _load_from_save_file() -> void:
)

display_mode_button.text = Locale.get_ui_label(SaveFile.settings["display_mode"])
var a: int = SaveFile.settings["display_resolution"][0]
var b: int = SaveFile.settings["display_resolution"][1]
display_resolution_button.text = "{a} x {b}".format({"a": a, "b": b})
var width: int = SaveFile.settings["display_resolution"][0]
var height: int = SaveFile.settings["display_resolution"][1]
display_resolution_button.text = "{a} x {b}".format({"a": width, "b": height})


#############
Expand All @@ -103,6 +105,9 @@ func _connect_signals() -> void:
display_resolution_button.button_up.connect(_on_display_resolution_button_up)
display_language_button.button_up.connect(_on_display_language_button_up)

SignalBus.display_mode_settings_updated.connect(_on_display_mode_settings_updated)
SignalBus.display_resolution_settings_updated.connect(_on_display_resolution_settings_updated)


func _on_tab_changed(tab_data: TabData) -> void:
if tab_data.id == TAB_DATA_ID:
Expand All @@ -117,16 +122,30 @@ func _on_audio_data_changed(toggle: bool, value: float, id: String) -> void:

func _on_effect_data_changed(toggle: bool, value: float, id: String) -> void:
SignalBus.effect_settings_update.emit(toggle, value, id)
## TODO typing effect


func _on_display_mode_button_up() -> void:
pass ## TODO
SignalBus.display_mode_settings_toggle.emit()
display_mode_button.release_focus()


func _on_display_resolution_button_up() -> void:
pass ## TODO
SignalBus.display_resolution_settings_toggle.emit()
display_resolution_button.release_focus()


func _on_display_language_button_up() -> void:
pass ## TODO
pass ## TODO: ADF-24 | Localization


func _on_display_mode_settings_updated(display_mode: String) -> void:
display_mode_button.text = Locale.get_ui_label(display_mode)


func _on_display_resolution_settings_updated(width: int, height: int) -> void:
## TODO: replace resolution setting with a different one
display_resolution_button.text = "{a} x {b}".format({"a": width, "b": height})


func _on_display_language_updated() -> void:
pass ## TODO: ADF-24 | Localization

0 comments on commit 62b6b8f

Please sign in to comment.