From e34a20599d4ae61b259ec070ba480501900b71f5 Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Sun, 26 Apr 2026 14:26:39 +0800 Subject: [PATCH] feat: add tp in devpanel --- include/Cubed/dev_panel.hpp | 1 + src/dev_panel.cpp | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/Cubed/dev_panel.hpp b/include/Cubed/dev_panel.hpp index 390d2a8..2092566 100644 --- a/include/Cubed/dev_panel.hpp +++ b/include/Cubed/dev_panel.hpp @@ -19,6 +19,7 @@ class DevPanel { struct PlayerProfile { int game_mode = 0; int gait = 0; + float pos[3] = {0.0f, 0.0f, 0.0f}; }; struct TextEditing { bool perlin_seed = false; diff --git a/src/dev_panel.cpp b/src/dev_panel.cpp index 54f5c08..11fb7ab 100644 --- a/src/dev_panel.cpp +++ b/src/dev_panel.cpp @@ -264,14 +264,19 @@ void DevPanel::show_player_tab_item() { } if (m_player->game_mode() == GameMode::CREATIVE) { if (ImGui::Combo("Gait", &m_player_profile.gait, GAITS, IM_ARRAYSIZE(GAITS))) { - if (m_player_profile.gait == 0) { - m_player->gait() = Gait::WALK; - } else if (m_player_profile.gait == 1) { - m_player->gait() = Gait::RUN; - } else { - ASSERT_MSG(false, "Unknown Gait"); + if (m_player_profile.gait == 0) { + m_player->gait() = Gait::WALK; + } else if (m_player_profile.gait == 1) { + m_player->gait() = Gait::RUN; + } else { + ASSERT_MSG(false, "Unknown Gait"); + } } } + ImGui::DragFloat3("##player_pos", m_player_profile.pos); + ImGui::SameLine(); + if (ImGui::Button("TP")) { + m_player->set_player_pos({m_player_profile.pos[0], m_player_profile.pos[1], m_player_profile.pos[2]}); } ImGui::SliderFloat("Acceleration", &m_player->acceleration(), 1.0f, 200.0f); ImGui::SliderFloat("Deceleration", &m_player->deceleration(), 1.0f, 200.0f);