Example #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            //graphicDevice-Tweaking
            graphics.PreferredBackBufferHeight = screenHeihgt;
            graphics.PreferredBackBufferWidth = screenWidth;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            //draw main-menu after starting
            gsCurrentGamestate = GameState.mainMenu;

            //init buttons
            //loading default button texture
            btnDefaultTexture = Content.Load<Texture2D>(@"buttons\button_default");
            btnPlay = new button(btnDefaultTexture, graphics.GraphicsDevice);
            btnOptions = new button(btnDefaultTexture, graphics.GraphicsDevice);
            btnHighscore = new button(btnDefaultTexture, graphics.GraphicsDevice);
            btnQuit = new button(btnDefaultTexture, graphics.GraphicsDevice);

            //Vector2 btnBasePos = new Vector2(((graphics.GraphicsDevice.Viewport.Height / 2) - 200), ((graphics.GraphicsDevice.Viewport.Width / 2) + 100));

            btnPlay.position = new Vector2(((graphics.GraphicsDevice.Viewport.Width / 2) - 50), ((graphics.GraphicsDevice.Viewport.Height / 2) - 150));
            btnOptions.position = new Vector2(((graphics.GraphicsDevice.Viewport.Width / 2) - 50), ((graphics.GraphicsDevice.Viewport.Height / 2) - 100));
            btnHighscore.position = new Vector2(((graphics.GraphicsDevice.Viewport.Width / 2) - 50), ((graphics.GraphicsDevice.Viewport.Height / 2) - 50));
            btnQuit.position = new Vector2(((graphics.GraphicsDevice.Viewport.Width / 2) - 50), ((graphics.GraphicsDevice.Viewport.Height / 2) - 0));



            base.Initialize();
        }