A simple script for managing resolution scaling in FNA.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Evan Hemsley 84e1bdd363 change namespace 10 months ago
LICENSE Initial commit 10 months ago
README.md fix name 10 months ago
ResolutionScaler.cs change namespace 10 months ago

README.md

ResolutionScaler

A simple script for managing resolution scaling in FNA.

Usage

Call ResolutionScaler.Init with your display width and height, and your virtual width and height.

    ResolutionScaler.Init(
        GraphicsDevice.PresentationParameters.BackBufferWidth,
        GraphicsDevice.PresentationParameters.BackBufferHeight,
            PLAY_AREA_WIDTH,
            PLAY_AREA_HEIGHT
    );

Then you can pass ResolutionScaler.TransformMatrix to FNA's SpriteBatch to properly transform your game's render target.

    SpriteBatch.Begin(
        SpriteSortMode.Deferred,
        null,
        null,
        null,
        null,
        null,
        ResolutionScaler.TransformMatrix
    );

    SpriteBatch.Draw(
        GameRenderTarget,
        Vector2.Zero,
        Color.White
    );

    SpriteBatch.End();