generated from Persson-dev/Godot-Xmake
begin network
This commit is contained in:
@@ -5,11 +5,14 @@
|
||||
|
||||
using namespace godot;
|
||||
|
||||
static constexpr char MainScenePath[] = "res://Scenes/Levels/world.tscn";
|
||||
|
||||
namespace blitz {
|
||||
|
||||
void MainMenu::_bind_methods() {}
|
||||
void MainMenu::_bind_methods() {
|
||||
godot::ClassDB::bind_method(godot::D_METHOD("on_connected"), &MainMenu::OnConnected);
|
||||
ADD_SIGNAL(MethodInfo("create_game", PropertyInfo(Variant::INT, "port"), PropertyInfo(Variant::BOOL, "dedicated")));
|
||||
ADD_SIGNAL(MethodInfo("join_game", PropertyInfo(Variant::STRING, "address"), PropertyInfo(Variant::INT, "port")));
|
||||
ADD_SIGNAL(MethodInfo("change_scene"));
|
||||
}
|
||||
|
||||
MainMenu::MainMenu() {}
|
||||
|
||||
@@ -32,12 +35,17 @@ void MainMenu::_ready() {
|
||||
m_QuitButton->connect("pressed", callable_mp(this, &MainMenu::OnQuitPressed));
|
||||
}
|
||||
|
||||
void MainMenu::OnConnected() {
|
||||
emit_signal("change_scene");
|
||||
queue_free();
|
||||
}
|
||||
|
||||
void MainMenu::OnJoinPressed() {
|
||||
get_tree()->change_scene_to_file(MainScenePath);
|
||||
emit_signal("join_game", "localhost", 25565);
|
||||
}
|
||||
|
||||
void MainMenu::OnCreatePressed() {
|
||||
get_tree()->change_scene_to_file(MainScenePath);
|
||||
emit_signal("create_game", 25565, false);
|
||||
}
|
||||
|
||||
void MainMenu::OnQuitPressed() {
|
||||
|
||||
Reference in New Issue
Block a user