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; } }
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); } }
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; }
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; }
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; } } }
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]; } } }
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); }
public int GetWidth(MenuScreen screen) { return HitBox().Width; }
public int GetHeight(MenuScreen screen) { return HitBox().Height; }
public void Draw(MenuScreen screen, GameTime gameTime) { buttonStyle.Draw(screen.ScreenManager.SpriteBatch); }
public int GetWidth(MenuScreen screen) { return ListStyle.Width; }
public int GetWidth(MenuScreen screen) { return FieldStyle.Size().Width; }
public virtual int GetWidth(MenuScreen screen) { return (int)screen.ScreenManager.Font.MeasureString(Text).X; }
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]; } }
public void Draw(MenuScreen screen, GameTime gameTime) { ItemStyle.Draw(screen.ScreenManager.SpriteBatch); ItemStyle.Color = ItemStyle.DefaultColor; }
public virtual int GetHeight(MenuScreen screen) { return screen.ScreenManager.Font.LineSpacing; }
public int GetHeight(MenuScreen screen) { return ListStyle.Height; }
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); } }
public int GetHeight(MenuScreen screen) { return FieldStyle.Size().Height; }