Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera SwapChain should automatically react to window changes #1673

Open
profexorgeek opened this issue Jan 15, 2025 · 0 comments
Open

Camera SwapChain should automatically react to window changes #1673

profexorgeek opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels

Comments

@profexorgeek
Copy link
Collaborator

NOTE: @vchelaru asked me to file this card but it may not be desired behavior. For example, if I specify a custom render target size, I may not want that overridden if the window resizes!

When the user resizes the window, the render target for a custom camera does not have its size updated. You can fix this by binding an event such as the one below to the FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged event:

void OnSizeOrOrientationChange(object sender, EventArgs e)
{
    Camera.Main.SwapChain.UpdateRenderTargetSize(
        FlatRedBallServices.Game.Window.ClientBounds.Width,
        FlatRedBallServices.Game.Window.ClientBounds.Height);
}

If you do not add this event handler, the render target size does not change. You can see this happening with the black bars in the gif below.

render-target-resize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants