From 0999b7da780b4680a39b1c34b160893c60bfcf58 Mon Sep 17 00:00:00 2001 From: Evan Hemsley Date: Fri, 17 Jul 2020 13:56:08 -0700 Subject: [PATCH] update README with usage details --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf7d955..1eb74a8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ # ResolutionScaler -A simple script for managing resolution scaling in FNA. \ No newline at end of file +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. + +```cs + Resolution.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. + +```cs + SpriteBatch.Begin( + SpriteSortMode.Deferred, + null, + null, + null, + null, + null, + Resolution.TransformMatrix + ); + + SpriteBatch.Draw( + GameRenderTarget, + Vector2.Zero, + Color.White + ); + + SpriteBatch.End(); +```