protected internal override void Update(float delta) { mPassTime = (mPassTime + delta) % Duration; void OnSizeChange() { //ensure the size of input text Size = new Size(Size.Width, Utility.Max(Size.Height, 4)); FontSize = Size.Height - 4; } void OnFontChange() { //when font changed var font = FontClass.Fonts(FontSize); //do not need to change the text buffer, because we do not change any propertry if (mTextBuffer != null && mTextBuffer.Content == Content && mTextBuffer.Font == font) { return; } Utility.Dispose(ref mTextBuffer); mTextBuffer = new RowText(Content, font); } OnSizeChange(); OnFontChange(); //ensure the cursor position is legal, from [0, content.length] Cursor = Utility.Clamp(Cursor, 0, Content.Length); }
public virtual void DrawText(Point2f position, RowText text, Colorf color) { DrawImage(new Rectanglef( position.X, position.Y, position.X + text.Size.Width, position.Y + text.Size.Height), text.Image, color, GuiRenderMode.Text); }
public virtual void DrawText(Position <float> position, RowText text, Color <float> color) { DrawImage(new Rectangle <float>( position.X, position.Y, position.X + text.Size.Width, position.Y + text.Size.Height), text.Image, color); }
public GuiInputText(string content, FontClass fontClass, Size size) { Content = content; FontClass = fontClass; Size = size; Cursor = 0; Style = new GuiInputTextStyle(); Dragable = false; mTextBuffer = null; }
internal void SetPropertyToAsset() { //do not need to update the input text if (mInputText != null && mInputText.Content == Content && mInputText.Font == Font) { return; } //dispose the input text and create new input text Utility.Dispose(ref mInputText); //limit the cursor position CursorLocation = Utility.Clamp(CursorLocation, NullLocation, Content.Length); mInputText = new RowText(Content, Font); }