Exemplo n.º 1
0
        public void ChangeResolution(int width, int height)
        {
            screenWidth  = width;
            screenHeight = height;
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            inv.UpdateResolution();
            menu.changeResolution();
            chat.changeResolution();
            editor.ChangeResolution();
            hb.updateResolution();
            graphics.ApplyChanges();

            double scale = width / 300;

            scale                 = Math.Round(scale);
            camera.Zoom           = (float)scale;
            camera.ViewportWidth  = GraphicsDevice.Viewport.Width;
            camera.ViewportHeight = GraphicsDevice.Viewport.Height;

            var pp = GraphicsDevice.PresentationParameters;

            lightsTarget = new RenderTarget2D(
                GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight);
            mainTarget = new RenderTarget2D(
                GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight);

            Debug.WriteLine("w" + height + " a" + graphics.PreferredBackBufferWidth);
            graphics.PreferredBackBufferHeight = height;
            graphics.ApplyChanges();
        }