diff --git a/CMakeLists.txt b/CMakeLists.txt index 207273c..18bc1c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ add_executable(${PROJECT_NAME} src/gameplay/builders/snowy_plain_builder.cpp src/gameplay/river_worm.cpp src/gameplay/river_path.cpp - src/block.cpp + src/gameplay/block.cpp src/gameplay/vertex_data.cpp src/gameplay/builders/ocean_builder.cpp src/gameplay/network_server.cpp diff --git a/include/Cubed/app.hpp b/include/Cubed/app.hpp index 7ffb49e..06eabbe 100644 --- a/include/Cubed/app.hpp +++ b/include/Cubed/app.hpp @@ -16,6 +16,7 @@ public: bool is_client = false; int port = 25530; std::string ip{"127.0.0.1"}; + std::string player{"Unknown"}; }; App(); diff --git a/src/app.cpp b/src/app.cpp index a825173..61e97c6 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -74,7 +74,7 @@ void App::init(int argc, char** argv) { m_client->start(m_argument.ip, m_argument.port); // init will send packet - m_client_world.init("test", m_client); + m_client_world.init(m_argument.player, m_client); Logger::info("World Init Success"); @@ -114,6 +114,11 @@ void App::handle_argument(int argc, char** argv) { [&](ArgParser& p) { auto arg = p.require_next("--ip"); m_argument.ip = arg; + }}, + {"--player", + [&](ArgParser& p) { + auto arg = p.require_next("--player"); + m_argument.player = arg; }} }; @@ -130,17 +135,17 @@ void App::handle_argument(int argc, char** argv) { } void App::handle_toml() { - toml::table ip; + toml::table server; try { - ip = toml::parse_file("ip.toml"); + server = toml::parse_file("server.toml"); } catch (const toml::parse_error& e) { Logger::warn("Ip toml parse error {}", e.what()); return; } - m_argument.ip = *TOML::safe_get_value(ip, "ip", "127.0.01"); - m_argument.port = *TOML::safe_get_value(ip, "port", 25530); - m_argument.is_client = *TOML::safe_get_value(ip, "client", false); + m_argument.ip = *TOML::safe_get_value(server, "ip", "127.0.01"); + m_argument.port = *TOML::safe_get_value(server, "port", 25530); + m_argument.is_client = *TOML::safe_get_value(server, "client", false); } void App::key_callback(GLFWwindow* window, int key, int scancode, int action, diff --git a/src/dev_panel.cpp b/src/dev_panel.cpp index 7a97ac7..f871b91 100644 --- a/src/dev_panel.cpp +++ b/src/dev_panel.cpp @@ -582,6 +582,7 @@ void DevPanel::show_player_tab_item() { return; } if (ImGui::BeginTabItem("player")) { + ImGui::Text("Player %s", m_player->get_name().c_str()); if (ImGui::Combo("GameMode", &m_player_profile.game_mode, GAME_MODES, IM_ARRAYSIZE(GAME_MODES))) { if (m_player_profile.game_mode == 0) {