Exemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Exemplo n.º 2
0
        public void start(Game1 game, GraphicsDevice graphicsDevice)
        {
            Console.WriteLine("Renderer.start");
            this.game = game;
            this.graphicsDevice = graphicsDevice;
            spriteBatch = new SpriteBatch(graphicsDevice);

            SettingsManager.getInstance.getGraphicsSettings(out height, out width, out fps, out fullscreen);

            /*
            const bool resultionIndependent = true;
            Vector2 baseScreenSize = new Vector2(800, 600);

            screenScalingFactor = new Vector3(1f, 1f, 1f);
            float horScaling = 0;
            float verScaling = 0;
            if (resultionIndependent)
            {
                horScaling = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / baseScreenSize.X;
                verScaling = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / baseScreenSize.Y;

                screenScalingFactor = new Vector3(horScaling, verScaling, 1);
            }
            else
            {
                screenScalingFactor = new Vector3(1, 1, 1);
            }

            Console.WriteLine("Scale factor: " + screenScalingFactor);

            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            screenCenter = new Vector2(horScaling / 2f, verScaling / 2f);
            */

            if (fullscreen)
            {
                graphics.ToggleFullScreen();
            }
            else
            {
                graphics.PreferredBackBufferHeight = height;
                graphics.PreferredBackBufferWidth = width;
                graphics.ApplyChanges();
            }

            screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2f, graphics.GraphicsDevice.Viewport.Height / 2f);

            this.game.TargetElapsedTime = TimeSpan.FromSeconds(1.0 / fps);

            Console.WriteLine("Width: " + game.Window.ClientBounds.Width);
            Console.WriteLine("Height: " + game.Window.ClientBounds.Height);
            Console.WriteLine("ScreenCenter: " + screenCenter);
            Console.WriteLine("Fps: " + fps);
        }