add a default "no scale" orthographic scaler implementation

This commit is contained in:
Gered 2013-08-24 19:01:05 -04:00
parent c5d996a5e9
commit 621017aa58
2 changed files with 32 additions and 0 deletions

View file

@ -182,6 +182,7 @@
<Compile Include="IServiceLocator.cs" /> <Compile Include="IServiceLocator.cs" />
<Compile Include="BasicGameApp.cs" /> <Compile Include="BasicGameApp.cs" />
<Compile Include="Graphics\IOrthoPixelScaler.cs" /> <Compile Include="Graphics\IOrthoPixelScaler.cs" />
<Compile Include="Graphics\NoScaleOrthoPixelScaler.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup> <ItemGroup>

View file

@ -0,0 +1,31 @@
using System;
namespace Blarg.GameFramework.Graphics
{
public class NoScaleOrthoPixelScaler : IOrthoPixelScaler
{
Rect _viewport;
public void Calculate(Rect viewport)
{
// no scaling whatsoever!
_viewport = viewport;
}
public int Scale
{
get { return 1; }
}
public int ScaledWidth
{
get { return _viewport.Width; }
}
public int ScaledHeight
{
get { return _viewport.Height; }
}
}
}