예제 #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
파일: List.cs 프로젝트: nian0601/MobileGame
        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
파일: List.cs 프로젝트: nian0601/MobileGame
 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
파일: List.cs 프로젝트: nian0601/MobileGame
        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
파일: List.cs 프로젝트: nian0601/MobileGame
 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;
 }