Class GraphicsHelper
Provides helper methods for calculating graphics related values.
public static class GraphicsHelper
- Inheritance
-
GraphicsHelper
- Inherited Members
Methods
CalculateDisplayRect(GraphicsDevice)
Calculates the destination rectangle for rendering the game, maintaining the target aspect ratio.
public static Rectangle CalculateDisplayRect(GraphicsDevice graphics)
Parameters
graphicsGraphicsDeviceThe graphics device containing the current viewport dimensions.
Returns
- Rectangle
A Microsoft.Xna.Framework.Rectangle representing the area of the screen where the game should be drawn.
Remarks
This method fits the game's internal resolution (Resolution) into the current window size (Microsoft.Xna.Framework.Graphics.GraphicsDevice.Viewport). The result is centered, creating bars if the window aspect ratio does not match the game's aspect ratio.