protected override void Draw(ref UiViewDrawParameters parameters) { float opacity = parameters.Opacity; if (opacity == 0 || TextColor.Value.A == 0) { return; } base.Draw(ref parameters); if (_fontFace == null) { _fontFace = FontManager.Instance.FindFont(FontName); } float scale; UniversalFont font = _fontFace.Find(FontSize, out scale); Rectangle bounds = ScreenBounds; if (Text.Length > 0) { bounds = _textMargin.ComputeRect(bounds); } parameters.DrawBatch.DrawText(font, Text, bounds, TextAlign, TextColor.Value * opacity, (float)FontSpacing / 1000.0f, (float)LineHeight / 100.0f, scale, _rotation); }
protected override void Draw(ref UiViewDrawParameters parameters) { float opacity = parameters.Opacity; if (opacity == 0 || TextColor.Value.A == 0) { return; } base.Draw(ref parameters); UiFont font = Font; float scale = font.Scale; scale *= _rescale; Rectangle bounds = ScreenBounds; if (Text.Length > 0) { bounds = _textMargin.ComputeRect(bounds); } parameters.DrawBatch.DrawText(font.Font, Text, bounds, TextAlign, TextColor.Value * opacity, font.Spacing, (float)_lineHeight / 100.0f, scale, _rotation); }
void IBackgroundDrawable.Draw(AdvancedDrawBatch drawBatch, Rectangle target, Color color) { float scale = _scaleByUnit ? (float)UiUnit.Unit : 1; color = GraphicsHelper.MultiplyColors(color, _color.Value); target = _margin.ComputeRect(target); drawBatch.DrawNinePatchRect(_image, target, color, scale * _scale); }
private void CreateInput() { if (_nativeInput != null) { _nativeInput.Unfocus(); } Focused = true; _original = Text.StringValue; Rectangle rect = ScreenBounds; //rect.Y -= AppMain.Current.MainView.OffsetBoundsVertical; rect = _nativeInputMargin.ComputeRect(rect); _nativeInput = new NativeInput(rect, _inputType, _original, _fontSize, _nativeInputAlign, this); AppMain.Redraw(true); }