diff options
Diffstat (limited to 'src/core/application.cpp')
| -rw-r--r-- | src/core/application.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/application.cpp b/src/core/application.cpp index 435b6aa..c4c0e71 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -22,6 +22,7 @@ namespace Donut s_instance = this; m_window = std::make_unique<Window>(name, width, height); + m_window->set_event_callback([this](Event& event) { on_event(event); @@ -68,9 +69,13 @@ namespace Donut dispatcher.dispatch<WindowResizeEvent>([this, &event](WindowResizeEvent& e) { if (e.get_width() == 0 || e.get_height() == 0) + { m_minimized = true; + } else + { m_minimized = false; + } Renderer::on_window_resize(e.get_width(), e.get_height()); @@ -152,7 +157,9 @@ namespace Donut void Application::on_init() { + Logger::init(); Renderer::init(); + Renderer::on_window_resize(1280, 720); RenderCommand::set_face_culling(false); @@ -228,30 +235,23 @@ namespace Donut if (!m_compute_shader) { - std::cout << "Failed to create compute shader! Falling back to CPU texture generation." << std::endl; + DONUT_WARN("Failed to create compute shader! Falling back to CPU texture generation."); m_use_compute_shader = false; } else - std::cout << "Compute shader created successfully!" << std::endl; + DONUT_INFO("Compute shader created successfully!"); m_processed_texture = Texture2D::create(256, 256); m_compute_brightness = 0.0f; m_compute_contrast = 1.0f; m_compute_saturation = 1.0f; m_use_compute_shader = true; - - std::cout << "=== Compute Shader Test ===" << std::endl; - std::cout << "C - Toggle compute shader on/off" << std::endl; - std::cout << "Arrow Keys - Adjust brightness (Up/Down) and contrast (Left/Right)" << std::endl; - std::cout << "Q/E - Adjust saturation" << std::endl; - std::cout << "WASD - Move camera" << std::endl; - std::cout << "Mouse - Look around" << std::endl; - std::cout << "==========================" << std::endl; } void Application::on_shutdown() { Renderer::shutdown(); + Logger::shutdown(); } void Application::on_update() @@ -280,7 +280,7 @@ namespace Donut if (m_keys[GLFW_KEY_C] && !c_key_pressed) { m_use_compute_shader = !m_use_compute_shader; - std::cout << "Compute shader: " << (m_use_compute_shader ? "ON" : "OFF") << std::endl; + DONUT_INFO("Compute shader: {}", (m_use_compute_shader ? "ON" : "OFF")); c_key_pressed = true; } if (!m_keys[GLFW_KEY_C]) @@ -306,9 +306,8 @@ namespace Donut status_timer += m_delta_time; if (status_timer > 2.0f) { - std::cout << "Compute Shader Status - Brightness: " << m_compute_brightness - << ", Contrast: " << m_compute_contrast - << ", Saturation: " << m_compute_saturation << std::endl; + DONUT_INFO("Compute Shader Status:\nBrightness: {}\nContrast: {}\nSaturation: {}", + m_compute_brightness, m_compute_contrast, m_compute_saturation); status_timer = 0.0f; } @@ -320,7 +319,8 @@ namespace Donut Renderer::set_clear_color({ 0.0f, 0.0f, 0.0f, 1.0f }); Renderer::clear(); - if (m_use_compute_shader && m_processed_texture) + if (m_use_compute_shader && + m_processed_texture) { m_processed_texture->bind(0); m_shader->set_int("u_Texture", 0); |
