Ejemplo n.º 1
0
        public ResolutionComponent(Game game, GraphicsDeviceManager graphics, Point virtualResolution, Point screenResolution, bool fullscreen, bool letterbox) : base(game)
        {
            _graphics         = graphics;
            VirtualResolution = virtualResolution;
            ScreenResolution  = screenResolution;
            _fullscreen       = fullscreen;
            _letterbox        = letterbox;

            Game.Components.Add(this);

            Game.Services.AddService <IResolution>(this);

            ResolutionAdapter = new ResolutionAdapter(_graphics);
            ResolutionAdapter.SetVirtualResolution(VirtualResolution.X, VirtualResolution.Y);
            ResolutionAdapter.SetScreenResolution(ScreenResolution.X, ScreenResolution.Y, _fullscreen, _letterbox);
            ResolutionAdapter.ResetViewport();
        }
Ejemplo n.º 2
0
 public void ResetViewport()
 {
     ResolutionAdapter.ResetViewport();
 }
Ejemplo n.º 3
0
 public override void Draw(GameTime gameTime)
 {
     ResolutionAdapter.ResetViewport();
     base.Draw(gameTime);
 }
Ejemplo n.º 4
0
 public Matrix TransformationMatrix()
 {
     return(ResolutionAdapter.TransformationMatrix());
 }
Ejemplo n.º 5
0
 public Vector2 ScreenToGameCoord(Vector2 screenCoord)
 {
     return(ResolutionAdapter.ScreenToGameCoord(screenCoord));
 }