Inheritance: System.EventArgs
 private void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
 {
     vp = e.Viewport;
 }
 void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
 {
     title.X = title.GetCenterPosition(Graphics.Viewport).X;
     netScreenButton.Position = netScreenButton.GetCenterPosition(Graphics.Viewport);
 }
        void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
        {
            if (playerShip != null)
            {
                playerShip.Position = playerShip.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport, playerShip.Origin * playerShip.Scale);
            }
            if (miniMap != null)
            {
                miniMap.Y = e.Viewport.TitleSafeArea.Y + 7.5f;
                miniMap.X = e.Viewport.TitleSafeArea.X + e.Viewport.TitleSafeArea.Width - miniMap.Width - 7.5f;
                miniShipInfoBg.X = miniMap.X - miniShipInfoBg.Width - 7.5f;
            }
            if (fogOfWar != null)
            {

                for (int row = 0; row <= fogOfWar.GetUpperBound(1); row++)
                {
                    for (int column = 0; column <= fogOfWar.GetUpperBound(0); column++)
                    {
                        fogOfWar[column, row].Width = miniMap.Width / fogOfWar.GetLength(0);
                        fogOfWar[column, row].Height = miniMap.Height / fogOfWar.GetLength(1);
                        fogOfWar[column, row].X = miniMap.X + fogOfWar[0, 0].Width * column;
                        fogOfWar[column, row].Y = miniMap.Y + fogOfWar[0, 0].Height * row;
                        fogOfWar[column, row].Color = Color.White;
                    }
                }
            }
        }
Exemple #4
0
 void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
 {
     _healthBar.Position = new Vector2(X - (_healthBar.Width / 2), Y - (Height / 1.5f));
 }
        void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
        {
            //Get the new viewport from EventArgs
            Viewport viewport = e.Viewport;

            //Re-position title based on new viewport
            gameTitle.X = gameTitle.GetCenterPosition(viewport).X;
            gameTitle.Y = viewport.Height;

            //Re-position all credits based on new viewport
            for (int i = 0; i < AdditionalSprites.Count; i++)
            {
                TextSprite credit = AdditionalSprites[i].Cast<TextSprite>();

                credit.X = credit.GetCenterPosition(viewport).X;

                if (i == 0)
                {
                    credit.Y = gameTitle.Y + gameTitle.Height;
                }
                else
                {
                    TextSprite prevCredit = AdditionalSprites[i - 1].Cast<TextSprite>();
                    credit.Y = prevCredit.Y + prevCredit.Height + (_creditsFont.LineSpacing - _creditsFont.MeasureString("A").Y);
                }
            }
        }
 void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
 {
     if (title != null)
     {
         title.Y = 5;
         title.X = title.GetCenterPosition(Graphics.Viewport).X;
     }
     if (reloadButton != null)
     {
         reloadButton.X = reloadButton.GetCenterPosition(Graphics.Viewport).X;
     }
 }
Exemple #7
0
 void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
 {
     //relocate all the sprites and labels to the correct position
     Sprites[0].Scale = new Vector2((float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Width / (float)Sprites[0].Texture.Width, (float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Height / (float)Sprites[0].Texture.Height);
     shipButton.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f - (shipButton.Width / 2), Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f);
     upgradeEquipmentButton.Position = new Vector2(shipButton.X - (1.5f * shipButton.Width), Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f);
     weaponsButton.Position = new Vector2(shipButton.X + (1.5f * shipButton.Width), Sprites.SpriteBatch.GraphicsDevice.Viewport.Height *.5f);
     PlayButton.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f - (PlayButton.Width / 2), Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .6f + (.5f * PlayButton.Height));
     noShipLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f - (noShipLabel.Width / 2), Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .6f + (.5f * noShipLabel.Height));
     noShipLabel.Y = Graphics.Viewport.Height / 2 + 100;
     noShipLabel.X = noShipLabel.GetCenterPosition(Graphics.Viewport).X;
 }
        void Options_ScreenResolutionChanged(object sender, ViewportEventArgs e)
        {
            BackButton.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f);

            //to unselect options label when changing to full screens and back
            foreach (ISprite s in AdditionalSprites)
            {
                if (s.GetType() == typeof(TextSprite))
                {
                    //We can deselect
                    (s as TextSprite).IsSelected = false;
                }
            }
        }