public UITextBox(int iX, int iY, int iWidth, int iHeight) : base(iX, iY) { focused = true; width = iWidth; height = iHeight; textboxRect = new mRectangle(iWidth, iHeight, new Color(205, 205, 205)); textboxRect.DrawBorder = true; textboxRect.X = x; textboxRect.Y = y; MonoPaint.RegisterFocusedButtonForTextInput(OnInput); }
public void Update() { int mX = InputManager.CurrentMouseState.X; int mY = InputManager.CurrentMouseState.Y; if (IsOver(mX, mY)) { textboxRect.Hovered = true; } else { textboxRect.Hovered = false; } //TODO: FIX if (InputManager.IsKeyPressed(Keys.Enter)) { focused = false; MonoPaint.UnRegisterFocusedButtonForTextInput(OnInput); if (textboxAction == null) { Unload(); } else { textboxAction(typedText.ToString());//Let user handle text } } if (InputManager.IsPressed(MouseInput.LeftButton)) { leftClicked = true; } if (InputManager.IsReleased(Input.MouseInput.LeftButton)) { leftClicked = false; } }