diff --git a/assets/icons/buttons/button_blue.png b/assets/icons/buttons/button_blue.png index 15992b1..2d42022 100644 Binary files a/assets/icons/buttons/button_blue.png and b/assets/icons/buttons/button_blue.png differ diff --git a/assets/icons/buttons/button_red.png b/assets/icons/buttons/button_red.png index 33efbce..ded8c81 100644 Binary files a/assets/icons/buttons/button_red.png and b/assets/icons/buttons/button_red.png differ diff --git a/export_presets.cfg b/export_presets.cfg index 2466695..2c98e39 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -23,7 +23,7 @@ script_export_mode=2 custom_template/debug="" custom_template/release="" debug/export_console_wrapper=0 -binary_format/embed_pck=false +binary_format/embed_pck=true texture_format/s3tc_bptc=true texture_format/etc2_astc=false shader_baker/enabled=false diff --git a/project.godot b/project.godot index cdf2aa9..eebd96f 100644 --- a/project.godot +++ b/project.godot @@ -24,5 +24,4 @@ MusicManager="*res://music_manager.gd" window/size/viewport_width=2560 window/size/viewport_height=1440 -window/size/resizable=false window/stretch/mode="viewport" diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 993aab8..157a0d5 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -4,8 +4,8 @@ [ext_resource type="Texture2D" uid="uid://xuw4ki75j3fy" path="res://assets/background/menubg.png" id="1_yqeox"] [ext_resource type="AudioStream" uid="uid://ditln0kq3u3dm" path="res://assets/sounds/music/menu_music.mp3" id="3_con2f"] [ext_resource type="PackedScene" uid="uid://gvx2ukt1why" path="res://scenes/option_popup.tscn" id="3_mhnvy"] -[ext_resource type="Texture2D" uid="uid://c5qd42wn52jx7" path="res://assets/icons/buttons/button_blue.png" id="3_v86rl"] -[ext_resource type="Texture2D" uid="uid://djqo5u4rtnaaq" path="res://assets/icons/buttons/button_red.png" id="4_13sgg"] +[ext_resource type="Texture2D" uid="uid://da6hb1mill5yn" path="res://assets/icons/buttons/button_blue.png" id="3_v86rl"] +[ext_resource type="Texture2D" uid="uid://t2pwtja7yfa4" path="res://assets/icons/buttons/button_red.png" id="4_13sgg"] [ext_resource type="Texture2D" uid="uid://dssoa5bxs2h4r" path="res://assets/icons/logo_game.png" id="5_4ytvr"] [ext_resource type="FontFile" uid="uid://bwvx53j60bvtd" path="res://assets/fonts/font.ttf" id="5_13sgg"] @@ -27,21 +27,25 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_yqeox") expand_mode = 1 +stretch_mode = 6 + +[node name="Sprite2D" type="Sprite2D" parent="TextureRect"] +position = Vector2(911, 403) +scale = Vector2(0.45898455, 0.43310553) +texture = ExtResource("5_4ytvr") +centered = false [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -197.0 -offset_top = -119.0 -offset_right = 569.0 -offset_bottom = 842.0 -grow_horizontal = 2 -grow_vertical = 2 -scale = Vector2(0.5, 0.5) +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 14.000004 +offset_top = -393.0 +offset_right = 464.0 +offset_bottom = 263.0 +grow_vertical = 0 +scale = Vector2(0.6, 0.6) theme_override_constants/separation = 20 [node name="start" type="TextureButton" parent="VBoxContainer"] @@ -56,10 +60,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -345.0 -offset_top = -121.5 -offset_right = 345.0 -offset_bottom = 122.5 +offset_left = -219.0 +offset_top = -69.0 +offset_right = 185.0 +offset_bottom = 74.0 grow_horizontal = 2 grow_vertical = 2 theme_override_colors/font_color = Color(0.056970224, 0.008738811, 0.00917984, 1) @@ -67,7 +71,7 @@ theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611 theme_override_colors/font_outline_color = Color(0.9581385, 0.7134137, 0.07074302, 1) theme_override_constants/outline_size = 16 theme_override_fonts/font = ExtResource("5_13sgg") -theme_override_font_sizes/font_size = 110 +theme_override_font_sizes/font_size = 65 text = "START" horizontal_alignment = 1 vertical_alignment = 1 @@ -79,16 +83,16 @@ texture_hover = ExtResource("4_13sgg") [node name="Label" type="Label" parent="VBoxContainer/option"] layout_mode = 0 -offset_left = 34.0 -offset_top = 33.0 -offset_right = 730.0 -offset_bottom = 277.0 +offset_left = 19.0 +offset_top = 17.0 +offset_right = 427.0 +offset_bottom = 157.0 theme_override_colors/font_color = Color(0.056970224, 0.008738811, 0.00917984, 1) theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9581385, 0.7134137, 0.07074302, 1) theme_override_constants/outline_size = 16 theme_override_fonts/font = ExtResource("5_13sgg") -theme_override_font_sizes/font_size = 110 +theme_override_font_sizes/font_size = 65 text = "OPCJE" horizontal_alignment = 1 vertical_alignment = 1 @@ -100,28 +104,22 @@ texture_hover = ExtResource("4_13sgg") [node name="Label" type="Label" parent="VBoxContainer/exit"] layout_mode = 0 -offset_left = 40.0 -offset_top = 32.0 -offset_right = 736.0 -offset_bottom = 276.0 +offset_left = 18.0 +offset_top = 18.0 +offset_right = 428.0 +offset_bottom = 156.0 theme_override_colors/font_color = Color(0.056970224, 0.008738811, 0.00917984, 1) theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9581385, 0.7134137, 0.07074302, 1) theme_override_constants/outline_size = 16 theme_override_fonts/font = ExtResource("5_13sgg") -theme_override_font_sizes/font_size = 110 +theme_override_font_sizes/font_size = 65 text = "ZAMKNIJ" horizontal_alignment = 1 vertical_alignment = 1 -[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer" parent="."] stream = ExtResource("3_con2f") -volume_db = 7.068 autoplay = true [node name="OptionPopup" parent="." instance=ExtResource("3_mhnvy")] - -[node name="Sprite2D" type="Sprite2D" parent="."] -position = Vector2(1277, 420.99997) -scale = Vector2(0.45898455, 0.43310553) -texture = ExtResource("5_4ytvr") diff --git a/scenes/test.gd b/scenes/test.gd new file mode 100644 index 0000000..3fb763a --- /dev/null +++ b/scenes/test.gd @@ -0,0 +1,9 @@ +extends TextureRect + + + +func _ready(): + print("Przed:", DisplayServer.window_get_size()) + DisplayServer.window_set_size(Vector2i(800, 600)) + await get_tree().create_timer(1.0).timeout + print("Po:", DisplayServer.window_get_size()) diff --git a/scenes/test.gd.uid b/scenes/test.gd.uid new file mode 100644 index 0000000..ee623f8 --- /dev/null +++ b/scenes/test.gd.uid @@ -0,0 +1 @@ +uid://c6jfhxwwf0po6 diff --git a/scripts/galaxy.gd b/scripts/galaxy.gd index a91072e..3f7311b 100644 --- a/scripts/galaxy.gd +++ b/scripts/galaxy.gd @@ -1,6 +1,6 @@ extends Control -@export var SectorScenePath: String = "res://scenes/Sector.tscn" +@export var SectorScenePath: String = "res://scenes/sector.tscn" @onready var container = $VBoxContainer func _ready(): diff --git a/scripts/menu.gd b/scripts/menu.gd index 50d123e..e0fa0c6 100644 --- a/scripts/menu.gd +++ b/scripts/menu.gd @@ -12,7 +12,7 @@ func _on_Opcje_pressed(): func _on_start_pressed(): - get_tree().change_scene_to_file("res://scenes/Galaxy.tscn") + get_tree().change_scene_to_file("res://scenes/galaxy.tscn") MusicManager.play_music() func _on_exit_pressed(): diff --git a/scripts/option_popup.gd b/scripts/option_popup.gd index f1da690..e73dadc 100644 --- a/scripts/option_popup.gd +++ b/scripts/option_popup.gd @@ -1,38 +1,57 @@ extends PopupPanel @onready var fullscreen_checkbox = $VBoxContainer/CheckBox -@onready var volume_slider = $VBoxContainer/HSlider @onready var resolution_dropdown = $VBoxContainer/Resolution +@onready var apply_button = $VBoxContainer/Apply +@onready var exit_button = $VBoxContainer/Exit var resolutions = [ + Vector2i(1280, 720), + Vector2i(1600, 900), Vector2i(1920, 1080), Vector2i(2560, 1440) ] func _ready(): + # Stan checkboxa fullscreen fullscreen_checkbox.button_pressed = DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN - $VBoxContainer/Exit.pressed.connect(_on_Zamknij_pressed) - $VBoxContainer/Apply.pressed.connect(_on_Zastosuj_pressed) - - # wypełnienie listy rozdzielczości - + + # Połączenia + apply_button.pressed.connect(_on_apply_pressed) + exit_button.pressed.connect(_on_close_pressed) + + # Wypełnienie listy rozdzielczości for res in resolutions: - - var label = "%d x %d" % [res.x, res.y] - resolution_dropdown.add_item(label) - -func _on_Zastosuj_pressed(): + resolution_dropdown.add_item("%d x %d" % [res.x, res.y]) + + # Wybór aktualnej + var current_size = DisplayServer.window_get_size() + for i in range(resolutions.size()): + if resolutions[i] == current_size: + resolution_dropdown.select(i) + break + +func _on_apply_pressed(): + var selected = resolution_dropdown.get_selected_id() + var new_size = resolutions[selected] + if fullscreen_checkbox.button_pressed: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) else: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) + + # Pobierz główne okno gry (root) + var main_window = get_tree().root.get_window() + main_window.size = new_size - # Tu możesz np. zapisać ustawienia do pliku - hide() + # Wyśrodkuj + var screen_size = DisplayServer.screen_get_size() + main_window.position = (screen_size - new_size) / 2 -func _on_Zamknij_pressed(): + print("Zmieniono ROZMIAR OKNA GRY na:", new_size) hide() -func _on_exit_pressed() -> void: - pass # Replace with function body. + +func _on_close_pressed(): + hide() diff --git a/scripts/sector.gd b/scripts/sector.gd index 6973d55..ad45403 100644 --- a/scripts/sector.gd +++ b/scripts/sector.gd @@ -1,7 +1,7 @@ extends Node2D -var StarScene = preload("res://scenes/Star.tscn") -var PlanetScene = preload("res://scenes/Planet.tscn") +var StarScene = preload("res://scenes/star.tscn") +var PlanetScene = preload("res://scenes/planet.tscn") @onready var PlanetStatPanel = $PlanetStatPanel @onready var BackButton: TextureButton = $BackButton @@ -30,7 +30,7 @@ func _process(delta): func _on_back_pressed(): - get_tree().change_scene_to_file("res://scenes/Galaxy.tscn") + get_tree().change_scene_to_file("res://scenes/galaxy.tscn") # --- Planet spawning --- func spawn_planets():