diff --git a/assets/background/background_menu.jpg b/assets/background/background_menu.jpg new file mode 100644 index 0000000..bef6827 Binary files /dev/null and b/assets/background/background_menu.jpg differ diff --git a/assets/background/background_menu.jpg.import b/assets/background/background_menu.jpg.import new file mode 100644 index 0000000..8544d5f --- /dev/null +++ b/assets/background/background_menu.jpg.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bfc6l14s8iwhp" +path="res://.godot/imported/background_menu.jpg-3c3b65aa507bd6c54b2f14ab5bd3bdcd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/background/background_menu.jpg" +dest_files=["res://.godot/imported/background_menu.jpg-3c3b65aa507bd6c54b2f14ab5bd3bdcd.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 diff --git a/concept_game.txt b/concept_game.txt index d3084c1..cc879ee 100644 --- a/concept_game.txt +++ b/concept_game.txt @@ -1,5 +1,5 @@ ================================================================================ - KONCEPCJA GRY: SPACE ROGUELITE (GODOT 4.5) + KONCEPCJA GRY: SPACE ROGUELITE (GODOT 4.7) ================================================================================ STATUS DOKUMENTU @@ -7,6 +7,9 @@ STATUS DOKUMENTU techniczny ani gotowy balans. - Podane liczby, szanse, zakresy i wzory są przykładami roboczymi. Mogą się zmieniać podczas prototypowania i testów, o ile zachowany zostanie ogólny charakter mechaniki. +- Ekran gry i jego układ mają dopasowywać się do rozmiaru okna. Elementy świata i interfejsu + zachowują stały rozmiar w pikselach podczas zmiany rozmiaru okna; widoczny obszar gry + może się poszerzać lub zwężać, ale obiekty nie są automatycznie skalowane. - Konkretne reguły przyjęte w implementacji należy później opisywać w documentation.txt. -------------------------------------------------------------------------------- @@ -323,4 +326,4 @@ Końcowe uwagi Pliki gra maja być ustrukturyzowane w profesjonalu sposób. Nie wszytsko w jednym. Masz robic katalogi i nowe pliki jesli to konieczne. Gra ma posiadac Menu. Na poczatek Nowa gra, Opcje, Save/Load i Extension -Wszystkie grafiki przygotuj i bedą w katalogu assets \ No newline at end of file +Wszystkie grafiki przygotuj i bedą w katalogu assets diff --git a/project.godot b/project.godot index 6bfcaaf..4f3ce3a 100644 --- a/project.godot +++ b/project.godot @@ -13,10 +13,15 @@ config_version=5 config/name="Randoloot" config/features=PackedStringArray("4.7", "Forward Plus") config/icon="res://icon.svg" +run/main_scene="res://scenes/ui/main_menu.tscn" [display] -window/stretch/mode="canvas_items" +window/size/viewport_width=1280 +window/size/viewport_height=720 +window/size/window_width_override=1280 +window/size/window_height_override=720 +window/stretch/mode="disabled" window/stretch/aspect="expand" [physics] diff --git a/scenes/game/game.tscn b/scenes/game/game.tscn new file mode 100644 index 0000000..55b18fb --- /dev/null +++ b/scenes/game/game.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/game/game.gd" id="1"] + +[node name="Game" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1") + diff --git a/scenes/ui/main_menu.tscn b/scenes/ui/main_menu.tscn new file mode 100644 index 0000000..242ad64 --- /dev/null +++ b/scenes/ui/main_menu.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/ui/main_menu.gd" id="1"] + +[node name="MainMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1") + diff --git a/scripts/game/game.gd b/scripts/game/game.gd new file mode 100644 index 0000000..de076f5 --- /dev/null +++ b/scripts/game/game.gd @@ -0,0 +1,10 @@ +extends Control + +func _ready() -> void: + var label := Label.new() + label.text = "Nowa gra" + label.add_theme_font_size_override("font_size", 32) + label.set_anchors_preset(Control.PRESET_CENTER) + label.position = Vector2(-80, -20) + add_child(label) + diff --git a/scripts/game/game.gd.uid b/scripts/game/game.gd.uid new file mode 100644 index 0000000..63b368a --- /dev/null +++ b/scripts/game/game.gd.uid @@ -0,0 +1 @@ +uid://d3behbql2g2b7 diff --git a/scripts/ui/main_menu.gd b/scripts/ui/main_menu.gd new file mode 100644 index 0000000..91644f8 --- /dev/null +++ b/scripts/ui/main_menu.gd @@ -0,0 +1,79 @@ +extends Control + +const GAME_SCENE := "res://scenes/game/game.tscn" +const MENU_BACKGROUND := preload("res://assets/background/background_menu.jpg") + +func _ready() -> void: + _build_menu() + +func _build_menu() -> void: + var background := TextureRect.new() + background.name = "Background" + background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + background.texture = MENU_BACKGROUND + background.expand_mode = TextureRect.EXPAND_IGNORE_SIZE + background.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED + add_child(background) + + var shade := ColorRect.new() + shade.name = "Shade" + shade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + shade.color = Color(0.015, 0.025, 0.06, 0.42) + add_child(shade) + + var layout := VBoxContainer.new() + layout.name = "MenuLayout" + layout.set_anchors_preset(Control.PRESET_CENTER_LEFT) + layout.position = Vector2(90, -190) + layout.custom_minimum_size = Vector2(390, 380) + layout.add_theme_constant_override("separation", 18) + add_child(layout) + + var title := Label.new() + title.text = "RANDOLOOT" + title.add_theme_font_size_override("font_size", 54) + title.add_theme_color_override("font_color", Color(0.92, 0.96, 1.0)) + layout.add_child(title) + + var subtitle := Label.new() + subtitle.text = "SPACE ROGUELITE" + subtitle.add_theme_font_size_override("font_size", 16) + subtitle.add_theme_color_override("font_color", Color(0.48, 0.78, 1.0)) + layout.add_child(subtitle) + + var spacer := Control.new() + spacer.custom_minimum_size.y = 12 + layout.add_child(spacer) + + _add_button(layout, "Start", _start_game, true) + _add_button(layout, "Wgraj / Zapisz", Callable(), false) + _add_button(layout, "Opcje", Callable(), false) + _add_button(layout, "Wyjście", _exit_game, false) + +func _add_button(parent: VBoxContainer, label: String, action: Callable, primary: bool) -> void: + var button := Button.new() + button.text = label + button.custom_minimum_size = Vector2(300, 54) + button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN + button.add_theme_font_size_override("font_size", 20) + var normal := StyleBoxFlat.new() + normal.bg_color = Color(0.10, 0.33, 0.55, 0.92) if primary else Color(0.035, 0.075, 0.13, 0.88) + normal.border_color = Color(0.20, 0.68, 0.95, 0.9) if primary else Color(0.26, 0.43, 0.58, 0.75) + normal.set_border_width_all(1) + normal.set_corner_radius_all(5) + normal.content_margin_left = 22 + button.add_theme_stylebox_override("normal", normal) + var hover := normal.duplicate() as StyleBoxFlat + hover.bg_color = Color(0.14, 0.44, 0.68, 0.98) if primary else Color(0.08, 0.17, 0.27, 0.98) + button.add_theme_stylebox_override("hover", hover) + button.add_theme_stylebox_override("pressed", hover) + if action.is_valid(): + button.pressed.connect(action) + parent.add_child(button) + +func _start_game() -> void: + get_tree().change_scene_to_file(GAME_SCENE) + +func _exit_game() -> void: + get_tree().quit() + diff --git a/scripts/ui/main_menu.gd.uid b/scripts/ui/main_menu.gd.uid new file mode 100644 index 0000000..d245a91 --- /dev/null +++ b/scripts/ui/main_menu.gd.uid @@ -0,0 +1 @@ +uid://csjojorlptcs1