mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: add tp in devpanel
This commit is contained in:
@@ -19,6 +19,7 @@ class DevPanel {
|
|||||||
struct PlayerProfile {
|
struct PlayerProfile {
|
||||||
int game_mode = 0;
|
int game_mode = 0;
|
||||||
int gait = 0;
|
int gait = 0;
|
||||||
|
float pos[3] = {0.0f, 0.0f, 0.0f};
|
||||||
};
|
};
|
||||||
struct TextEditing {
|
struct TextEditing {
|
||||||
bool perlin_seed = false;
|
bool perlin_seed = false;
|
||||||
|
|||||||
@@ -264,14 +264,19 @@ void DevPanel::show_player_tab_item() {
|
|||||||
}
|
}
|
||||||
if (m_player->game_mode() == GameMode::CREATIVE) {
|
if (m_player->game_mode() == GameMode::CREATIVE) {
|
||||||
if (ImGui::Combo("Gait", &m_player_profile.gait, GAITS, IM_ARRAYSIZE(GAITS))) {
|
if (ImGui::Combo("Gait", &m_player_profile.gait, GAITS, IM_ARRAYSIZE(GAITS))) {
|
||||||
if (m_player_profile.gait == 0) {
|
if (m_player_profile.gait == 0) {
|
||||||
m_player->gait() = Gait::WALK;
|
m_player->gait() = Gait::WALK;
|
||||||
} else if (m_player_profile.gait == 1) {
|
} else if (m_player_profile.gait == 1) {
|
||||||
m_player->gait() = Gait::RUN;
|
m_player->gait() = Gait::RUN;
|
||||||
} else {
|
} else {
|
||||||
ASSERT_MSG(false, "Unknown Gait");
|
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("Acceleration", &m_player->acceleration(), 1.0f, 200.0f);
|
||||||
ImGui::SliderFloat("Deceleration", &m_player->deceleration(), 1.0f, 200.0f);
|
ImGui::SliderFloat("Deceleration", &m_player->deceleration(), 1.0f, 200.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user