示例#1
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = currState.X;
            mousePos.Y = currState.Y;

            buttonStyle.ActivateNormalTexture();

            if (HitBox().Contains(mousePos))
            {
                buttonStyle.ActivateHooverTexture();

                if(KeyMouseReader.isKeyDown(Keys.LeftShift) && KeyMouseReader.LeftClick())
                {
                    myLockedToMouse = true;
                }
            }

            if(KeyMouseReader.RightClick())
            {
                myLockedToMouse = false;
            }

            if(myLockedToMouse == true)
            {
                Vector2 newPos = new Vector2(KeyMouseReader.GetMousePos().X, KeyMouseReader.GetMousePos().Y);
                Position = newPos;
            }
        }
示例#2
0
        public void Draw(MenuScreen screen, GameTime gameTime)
        {
            ListStyle.Draw(screen.ScreenManager.SpriteBatch);

            foreach (ListItem Item in ListItems)
            {
                if (Item.Selected)
                    Item.Color = Color.Red;
                Item.Draw(screen, gameTime);
            }
        }
示例#3
0
        public void Update(List List, MenuScreen screen, GameTime gameTime)
        {
            if (List.currState.LeftButton == ButtonState.Pressed && List.oldState.LeftButton == ButtonState.Released)
            {
                Selected = false;

                if (ItemStyle.ClickableArea().Contains(List.mousePos))
                {
                    ItemStyle.Color = Color.Gray;
                    Selected = true;
                    Console.WriteLine("Selected list item: " + Text);
                }
            }
            else if (ItemStyle.ClickableArea().Contains(List.mousePos))
                ItemStyle.Color = Color.Gray;
        }
示例#4
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = currState.X;
            mousePos.Y = currState.Y;

            FieldStyle.NormalTexture();

            if (FieldStyle.ClickableArea().Contains(mousePos))
                FieldStyle.HooverTexture();

            InputObject.Update();
            FieldStyle.Text = InputObject.Text;
        }
示例#5
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = currState.X;
            mousePos.Y = currState.Y;

            buttonStyle.NormalTexture();

            if (HitBox().Contains(mousePos))
            {
                buttonStyle.HooverTexture();
                if (KeyMouseReader.isKeyDown(Keys.LeftShift) && KeyMouseReader.LeftMouseDown())
                {
                    Vector2 newPos = new Vector2(KeyMouseReader.GetMousePos().X, KeyMouseReader.GetMousePos().Y);
                    Position = newPos;
                }
            }
        }
示例#6
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = currState.X;
            mousePos.Y = currState.Y;

            if (oldState.LeftButton == ButtonState.Pressed && currState.LeftButton == ButtonState.Released)
            {
                if (HitBox().Contains(mousePos))
                {
                    Color[] retrivedColor = new Color[1];
                    Rectangle sourceRect = new Rectangle(mousePos.X - HitBox().X, mousePos.Y - HitBox().Y, 1, 1);
                    pickerStyle.TextureToPickFrom.GetData<Color>(0, sourceRect, retrivedColor, 0, 1);
                    selectedColor = retrivedColor[0];
                }

            }
        }
示例#7
0
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            //position.X += selectionPos;

            MathHelper.Clamp(position.X, startPos.X - 100, startPos.X);

            Color color = isSelected ? Color.Yellow : Color.White;

            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            color *= screen.TransitionAlpha;

            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0, origin, scale, SpriteEffects.None, 0);
        }
示例#8
0
 public int GetWidth(MenuScreen screen)
 {
     return HitBox().Width;
 }
示例#9
0
 public int GetHeight(MenuScreen screen)
 {
     return HitBox().Height;
 }
示例#10
0
 public void Draw(MenuScreen screen, GameTime gameTime)
 {
     buttonStyle.Draw(screen.ScreenManager.SpriteBatch);
 }
示例#11
0
 public int GetWidth(MenuScreen screen)
 {
     return ListStyle.Width;
 }
示例#12
0
 public int GetWidth(MenuScreen screen)
 {
     return FieldStyle.Size().Width;
 }
示例#13
0
 public virtual int GetWidth(MenuScreen screen)
 {
     return (int)screen.ScreenManager.Font.MeasureString(Text).X;
 }
示例#14
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = Mouse.GetState().Position.X;
            mousePos.Y = Mouse.GetState().Position.Y;

            foreach (ListItem Item in ListItems)
                Item.Update(this, screen, gameTime);

            //selectedItem = null;

            for (int i = 0; i < ListItems.Count; i++)
            {
                if (ListItems[i].Selected)
                    selectedItem = ListItems[i];
            }
        }
示例#15
0
 public void Draw(MenuScreen screen, GameTime gameTime)
 {
     ItemStyle.Draw(screen.ScreenManager.SpriteBatch);
     ItemStyle.Color = ItemStyle.DefaultColor;
 }
示例#16
0
 public virtual int GetHeight(MenuScreen screen)
 {
     return screen.ScreenManager.Font.LineSpacing;
 }
示例#17
0
 public int GetHeight(MenuScreen screen)
 {
     return ListStyle.Height;
 }
示例#18
0
        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected)
            {
                selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
            }
            else
            {
                selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
            }
        }
示例#19
0
 public int GetHeight(MenuScreen screen)
 {
     return FieldStyle.Size().Height;
 }