feat(credits): add ESC key handling; remove about tab from dev panel

This commit is contained in:
2026-07-14 17:11:37 +08:00
parent e911413d84
commit 03e7b13dd1
4 changed files with 9 additions and 36 deletions

View File

@@ -53,7 +53,6 @@ private:
int m_samples_idx = 1; int m_samples_idx = 1;
int m_threads = 1; int m_threads = 1;
int m_chunk_style = 0; int m_chunk_style = 0;
void show_about_table_bar();
void show_biome_table_bar(); void show_biome_table_bar();
void show_time_table_bar(); void show_time_table_bar();
void show_cave_table_bar(); void show_cave_table_bar();

View File

@@ -11,6 +11,7 @@ public:
void init() override; void init() override;
private: private:
bool handle_key_event(const KeyEvent& e) override;
CreditsScene& m_scene; CreditsScene& m_scene;
}; };
} // namespace Cubed } // namespace Cubed

View File

@@ -80,7 +80,6 @@ void DevPanel::render() {
show_player_tab_item(); show_player_tab_item();
show_items_tab_item(); show_items_tab_item();
show_shader_tab_item(); show_shader_tab_item();
show_about_table_bar();
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
@@ -89,40 +88,6 @@ void DevPanel::render() {
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
} }
void DevPanel::show_about_table_bar() {
if (ImGui::BeginTabItem("about")) {
ImGui::Text(
"Cubed - A cube game like Minecraft, using C++ and OpenGL.");
ImGui::Text("Author: zhenyan121");
ImGui::Separator();
ImGui::Text("Libraries Used");
ImGui::Text("glad");
ImGui::Text("GLFW");
ImGui::Text("SOIL2");
ImGui::Text("GLM");
ImGui::Text("FreeType");
ImGui::Text("toml++");
ImGui::Text("Dear ImGui");
ImGui::Text("Tbb");
ImGui::Text("Asio");
ImGui::Text("protobuf");
ImGui::Text("zstd");
ImGui::Text("OpenAl Soft");
ImGui::Text("dr_libs");
ImGui::Separator();
ImGui::Text("Music");
ImGui::Text("'Find a Peaceful Place' by ROZKOL (Free Music Archive), "
"CC BY 4.0.");
ImGui::Separator();
ImGui::Text("Special Thanks");
ImGui::Text("TANGERIME");
ImGui::Text("SkyOnPole");
ImGui::Text("free_w_cloud");
ImGui::Text("Last but not least, thanks to you");
ImGui::EndTabItem();
}
}
void DevPanel::show_biome_table_bar() { void DevPanel::show_biome_table_bar() {
if (ImGui::BeginTabBar("Biome")) { if (ImGui::BeginTabBar("Biome")) {

View File

@@ -74,4 +74,12 @@ void CreditsUI::init() {
m_root_widget = std::move(image); m_root_widget = std::move(image);
} }
bool CreditsUI::handle_key_event(const KeyEvent& e) {
if (e.key == Key::ESCAPE && e.action == KeyAction::PRESS) {
m_scene.scene_manager().request_pop();
return true;
}
return UIManager::handle_key_event(e);
}
} // namespace Cubed } // namespace Cubed