some more stuff with imgui integration

This commit is contained in:
2026-04-07 01:17:01 -03:00
parent 87c96e276a
commit bfc70b2a50
5 changed files with 55 additions and 16 deletions

View File

@@ -358,6 +358,28 @@ glm::mat4 engine::transform_given_coordinate(glm::uvec2 coordinate) const {
return glm::translate(glm::mat4(1.0f), glm::vec3(world_x, 0.0f, world_z));
}
void engine::do_level_editor_ui() {
if (!debug_drawing.level_editor) {
return;
}
ImGui::Begin("Level Editor");
ImGui::Checkbox("Enabled", &is_editing_level);
ImGui::End();
}
void engine::do_debug_ui() {
ImGui::Begin("Debug");
ImGui::Checkbox("Playing Bounds", &debug_drawing.playing_bounds);
ImGui::Checkbox("Individual Tiles", &debug_drawing.individual_tiles);
ImGui::Checkbox("Level Editor", &debug_drawing.level_editor);
ImGui::End();
}
engine::engine()
: display(&input, {1920, 1080}, "Tanks Reborn"), renderer(&display),
models(load_models("../assets/models")),
@@ -375,9 +397,11 @@ void engine::run() {
const auto [map_min, map_max] = ::bounds_of(models.boundary);
const auto [view, projection] = ::calculate_camera_matrices(
map_min, map_max, 1920.0f / 1080.0f, 3.0f);
//, true, 3.0f);
//,
// true, glfwGetTime());
renderer.do_ui([this] {
do_level_editor_ui();
do_debug_ui();
});
auto request = render::request();
@@ -385,7 +409,10 @@ void engine::run() {
if (current_level.has_value()) {
request = add_level_to_render_request(request, &(*current_level));
}
request = add_playing_bounds_to_render_request(request);
if (debug_drawing.playing_bounds) {
request = add_playing_bounds_to_render_request(request);
}
renderer.render(request, view, projection);
} catch (const vuk::VkException &ex) {