WIP: Something
This commit is contained in:
parent
16b06ba642
commit
396b28dba1
@ -3,30 +3,33 @@ extends EntryPoint
|
|||||||
# -- A path to the config file for setting up the dedicated server
|
# -- A path to the config file for setting up the dedicated server
|
||||||
var config_file_path: String = ""
|
var config_file_path: String = ""
|
||||||
|
|
||||||
|
@export var main_menu: MainMenu = null
|
||||||
|
|
||||||
# -- Called when the node enters the scene tree for the first time.
|
# -- Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
parse_args()
|
parse_args()
|
||||||
|
if OS.has_feature("dedicated_server") or DisplayServer.get_name() == "headless":
|
||||||
if OS.has_feature("dedicated_server") or DisplayServer.get_name() == "headless":
|
var err := start_dedicated_server()
|
||||||
var err := start_dedicated_server()
|
if err != OK:
|
||||||
if err != OK:
|
push_error("Couldn't start the dedicated server, err: " + str(err))
|
||||||
push_error("Couldn't start the dedicated server, err: " + str(err))
|
else:
|
||||||
else:
|
var err := start_game()
|
||||||
var err := start_game()
|
if err != OK:
|
||||||
if err != OK:
|
push_error("Couldn't start the game, err: " + str(err))
|
||||||
push_error("Couldn't start the game, err: " + str(err))
|
|
||||||
|
|
||||||
# -- Parse command line arguments
|
# -- Parse command line arguments
|
||||||
func parse_args() -> void:
|
func parse_args() -> void:
|
||||||
var args := Array(OS.get_cmdline_args())
|
var args := Array(OS.get_cmdline_args())
|
||||||
var config_arg: String = "--config"
|
var config_arg: String = "--config"
|
||||||
if args.has(config_arg):
|
if args.has(config_arg):
|
||||||
var index := args.find(config_arg)
|
var index := args.find(config_arg)
|
||||||
config_file_path = args[index + 1]
|
config_file_path = args[index + 1]
|
||||||
|
|
||||||
func start_dedicated_server() -> Error:
|
func start_dedicated_server() -> Error:
|
||||||
push_error("Dedicated server is not yet implemented")
|
push_error("Dedicated server is not yet implemented")
|
||||||
return ERR_METHOD_NOT_FOUND
|
return ERR_METHOD_NOT_FOUND
|
||||||
|
|
||||||
|
# -- When not dedicated server, just start the full game and load menu
|
||||||
func start_game() -> Error:
|
func start_game() -> Error:
|
||||||
return OK
|
# -- Draw the main menu
|
||||||
|
return OK
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://0hsqnr1kunv5"]
|
[gd_scene load_steps=3 format=3 uid="uid://0hsqnr1kunv5"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/entrypoint.gd" id="1_ce80t"]
|
[ext_resource type="Script" path="res://src/entrypoint.gd" id="1_ce80t"]
|
||||||
|
[ext_resource type="Script" path="res://src/interfaces/main_menu/main_menu.gd" id="2_nmo60"]
|
||||||
|
|
||||||
[node name="Entrypoint" type="EntryPoint"]
|
[node name="Entrypoint" type="EntryPoint" node_paths=PackedStringArray("main_menu")]
|
||||||
script = ExtResource("1_ce80t")
|
script = ExtResource("1_ce80t")
|
||||||
|
main_menu = NodePath("MainMenu")
|
||||||
|
|
||||||
[node name="LevelPlaceholder" type="Node3D" parent="."]
|
[node name="LevelPlaceholder" type="Node3D" parent="."]
|
||||||
editor_description = "This node should be used for storing the map that is currently loaded"
|
editor_description = "This node should be used for storing the map that is currently loaded"
|
||||||
|
|
||||||
|
[node name="MainMenu" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
script = ExtResource("2_nmo60")
|
||||||
|
11
godot/src/interfaces/main_menu/main_menu.gd
Normal file
11
godot/src/interfaces/main_menu/main_menu.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class_name MainMenu extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
12
godot/src/interfaces/main_menu/main_menu.tscn
Normal file
12
godot/src/interfaces/main_menu/main_menu.tscn
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dt7rhpcor1wh7"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://src/interfaces/main_menu/main_menu.gd" id="1_dfg40"]
|
||||||
|
|
||||||
|
[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_dfg40")
|
Loading…
Reference in New Issue
Block a user