/// <summary> /// Handles the input for the screen. /// </summary> /// <param name="input">The current input state for the game.</param> public virtual void HandleInput(Input.Input input) { }
public override void HandleInput(Input.Input input) { if (active) { if (state != UIState.Disabled) { InputState leftState = input.GetMouseState(MouseButtons.Left); if (tabRect.Contains(input.MouseX(), input.MouseY())) { if (!tabClick && leftState == InputState.Pressed) { tabClick = true; yOff = input.MouseY() - tabRect.Y; xOff = input.MouseX() - tabRect.X; } } if (tabClick && (leftState == InputState.Held || leftState == InputState.Pressed)) { tabRect.X = input.MouseX() - xOff; if (tabRect.X < position.X) { tabRect.X = (int)position.X; } else if (tabRect.X > position.X + width - tabRect.Width) { tabRect.X = (int)(position.X + width - tabRect.Width); } scale = (tabRect.X - rect.X) / (rect.Width * 0.9f); OnMove(); } else if (tabClick && (leftState == InputState.Released)) { tabClick = false; OnRelease(); } } } }
/// <summary> /// Handles the input. /// </summary> /// <param name="input">The current input state.</param> public override void HandleInput(Input.Input input) { if (active) { if (state != UIState.Disabled) { InputState mouseState = input.GetMouseState(MouseButtons.Left); if (rect.Contains(input.MouseX(), input.MouseY())) { if (mouseState == InputState.Pressed || mouseState == InputState.Held) { if (state != UIState.Clicked && state != UIState.Held) { state = UIState.Clicked; OnClick(); } else { state = UIState.Held; } } else { state = UIState.MouseOver; if (mouseState == InputState.Released) { selected = !selected; OnRelease(); } } HandleInputChildren(input); } else { state = UIState.Default; } } } }
public void HandleInput(Input input) { foreach (Collideable c in movers) { c.HandleInput(input); } }
public void HandleInput(Input.Input input) { if (gameFocus) { cursorActive = true; foreach (UIBaseScreen s in screens) { if (s.IsActive) { if (s.ScreenName == "game" || s.ScreenName == "loading") { cursorActive = false; } s.HandleInput(input); } } cursorPos = input.MousePosV(); } }