-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVirtualResolutionScaler.cs
36 lines (28 loc) · 1.14 KB
/
VirtualResolutionScaler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#region
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace CludoEngine {
public class VirtualResolutionScaler {
private readonly GraphicsDevice _graphicsDevice;
private readonly bool _resolutionCompensation;
private readonly int _virtualHeight;
private readonly Scene _scene;
private readonly int _virtualWidth;
private int _oldCompensation = 0;
public VirtualResolutionScaler(Scene scene, int virtualWidth, int virtualHeight, GraphicsDevice graphicsDevice, bool resolutionCompensation) {
_scene = scene;
_virtualWidth = virtualWidth;
_virtualHeight = virtualHeight;
_graphicsDevice = graphicsDevice;
_resolutionCompensation = resolutionCompensation;
Createscale(virtualWidth, graphicsDevice);
}
public float Scale { get; private set; }
public Viewport VirtualViewport {
get { return new Viewport(0, 0, _virtualWidth, _virtualHeight); }
}
private void Createscale(int virtualWidth, GraphicsDevice graphicsDevice) {
Scale = 1.0f;
}
}
}