public override void Idle(GameTime gameTime) { base.Idle(gameTime); if (!cursorBlinkTimer.Started) { cursorBlinkTimer.Start(gameTime); } cursorBlinkTimer.Update(gameTime); if (TerminalMode && HasFocus) { if (KeyboardInput.ClickedKeys.Count != 0 && inputMachine.GetChar(KeyboardInput.ClickedKeys[0]) == '\n') { AddCurrentLineParts(Lines); CurrentLine = ""; updateOriginToCursor(); } List <string> allLines = GetAllLines(); inputMachine.Update(gameTime); int lineEndX = OriginX + BufferWidth; int lineEndY = OriginY + BufferHeight; //Clearing the display for (int bufferX = 0; bufferX < display.GetLength(0); bufferX++) { for (int bufferY = 0; bufferY < display.GetLength(1); bufferY++) { display[bufferX, bufferY] = '\0'; } } for (int y = OriginY; y < lineEndY; y++) { if (y < 0) { continue; } if (y >= allLines.Count) { break; } string line = allLines[y]; for (int x = OriginX; x < Math.Min(lineEndX, OriginX + line.Length); x++) { display[x, y - OriginY] = line[x]; } } } }
public override void Idle(GameTime gameTime) { base.Idle(gameTime); if (MaxCharsIsWidth) { inputMachine.MaxChars = Width / (Font.CharWidth + Font.HorizontalSpace); } if (HasFocus) { inputMachine.Update(gameTime); } }
public override void Idle(GameTime gameTime) { base.Idle(gameTime); HScrollbar.Activated = textAreaWidth > selectorWidth; VScrollbar.Activated = textAreaHeight > selectorHeight; if (HScrollbar.Activated) { HScrollbar.Width = LowerFieldWidth; HScrollbar.X = 0; HScrollbar.Y = Height - HScrollbar.Height; HScrollbar.MaxValue = textAreaWidth - selectorWidth; } if (VScrollbar.Activated) { VScrollbar.Height = LowerFieldHeight; VScrollbar.X = Width - VScrollbar.Width; VScrollbar.Y = UpperFieldHeight; VScrollbar.MaxValue = textAreaHeight - selectorHeight; } //Check up-icon mousepress if (IsUnderMouse && MouseInput.IsPressed(MouseButtons.Left) && IsMouseInRect( new Rectangle(RealX + IconLeft.Width, RealY + IconTop.Height, IconTop.Width - IconLeft.Width - IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height))) { if (MouseInput.IsClicked(MouseButtons.Left)) { GoUp(); } UpIsPressed = true; } else { UpIsPressed = false; } UpdateSelectedElements(); //TextField if (HasFocus) { inputMachine.Update(gameTime); } }
public override void Idle(GameTime gameTime) { base.Idle(gameTime); if (!HasFocus && Text == "") { inputMachine.Text = Value.ToString().Replace(',', '.'); } if (MaxCharsIsWidth) { inputMachine.MaxChars = Width / (Font.CharWidth + Font.HorizontalSpace); } if (HasFocus) { inputMachine.Update(gameTime); } }