Beispiel #1
0
        public void SetTitlePosition()
        {
            //The scale is nessecary because if the window gets resized the position changes aswell.
            Vector2 scale = new Vector2(GameSettings.Instance.Dimensions.X / 1366, GameSettings.Instance.Dimensions.Y / 768);
            //The middle x coordiantes get calculated here, it takes the width of the text and the width of the control bar,
            //and divides those by 2 to calculate the middle
            float x_position = (((205 * scale.X) - title.GetTextSize(title.Text).X) / 2);

            switch (status)
            {
            case 1:
                title.Position = new Vector2((177 * scale.X) + x_position, 231 * scale.Y);
                break;

            case 2:
                title.Position = new Vector2((177 * scale.X) + x_position, 356 * scale.Y);
                break;

            case 3:
                title.Position = new Vector2((177 * scale.X) + x_position, 481 * scale.Y);
                break;
            }
        }
        public void Update(GameTime gameTime)
        {
            itemtitle.Update(gameTime);
            itemsetting.Update(gameTime);
            arrow_left.Update(gameTime);
            arrow_right.Update(gameTime);

            arrow_right.Position = new Vector2(tempPosition + ((itemsetting.GetTextSize(itemsetting.Text).X) + (10 * x_scale)), arrow_right.Position.Y);

            itemtitle.Color   = Color.Black;
            arrow_left.Color  = Color.Black;
            arrow_right.Color = Color.Black;

            if (IsSelected)
            {
                var temp = fadeeffect.Update(gameTime);
                itemtitle.Alpha   = temp;
                itemsetting.Alpha = temp;
                arrow_left.Alpha  = temp;
                arrow_right.Alpha = temp;
                switch (currentSelected)
                {
                case selection.arrowleft:
                    arrow_left.Color = Color.White;
                    break;

                case selection.arrowright:
                    arrow_right.Color = Color.White;
                    break;
                }

                if (InputManager.Instance.KeyPressed(Keys.Enter) || ScreenManager.Instance.Controllers[0].A_Button(true))
                {
                    if (currentSelected == selection.arrowleft)
                    {
                        currentIndex--;
                        if (currentIndex < 0)
                        {
                            currentIndex = maxIndex - 1;
                        }
                    }
                    if (currentSelected == selection.arrowright)
                    {
                        currentIndex++;
                        if (currentIndex >= maxIndex)
                        {
                            currentIndex = 0;
                        }
                    }
                }
            }
            else
            {
                itemtitle.Alpha   = 1.0f;
                itemsetting.Alpha = 1.0f;
                arrow_left.Alpha  = 1.0f;
                arrow_right.Alpha = 1.0f;
                itemtitle.Color   = Color.Black;
                arrow_left.Color  = Color.Black;
                arrow_right.Color = Color.Black;
            }
        }