To be able to ensure we can signal for viewport (or multiple) have been resized.
We can use the event::window_resize to provide an API that allows us to trigger this event to update all of the aspect ratio parameters that is used widely throughout the codebase.
Having the assurance the aspect ratio is correct when the viewport or any dockspace that renders as a render target are being resized properly.
This is what is causing the stretch that occurs when resizing the viewport in imgui.
Checkout issue #177 for more on this bug.
Example Prototype
// internally in the game engine to setup what should happen
// when this event occurs and how to handle it.
m_bus->subscribe<event::window_resize>(this, &scene::on_resize);
void scene::on_resize(event::window_resize& p_event) {
m_aspect_ratio = static_cast<float>(p_event.width * p_event.height);
}
// editor-specific code that triggers the event when a window size occurs
// NOTE: Pseudo-code; replace with actual imgui API
if(ImGui::WindowChangeSize()) {
event::window_resize window_resize_event = {
.width = ImGui::AvailableRegion().x,
.height = ImGui::AvailableRegion().y,
};
trigger(window_resize_event);
}
To be able to ensure we can signal for viewport (or multiple) have been resized.
We can use the
event::window_resizeto provide an API that allows us to trigger this event to update all of the aspect ratio parameters that is used widely throughout the codebase.Having the assurance the aspect ratio is correct when the viewport or any dockspace that renders as a render target are being resized properly.
This is what is causing the stretch that occurs when resizing the viewport in imgui.
Checkout issue #177 for more on this bug.
Example Prototype