MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Draw

Method Draw

Source/Engine/UI/GUI/Tooltip.cs:250–280  ·  view source on GitHub ↗

()

Source from the content-addressed store, hash-verified

248
249 /// <inheritdoc />
250 public override void Draw()
251 {
252 var style = Style.Current;
253
254 // Background
255 Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Color.Lerp(style.BackgroundSelected, style.Background, 0.6f));
256 Render2D.FillRectangle(new Rectangle(1.1f, 1.1f, Width - 2, Height - 2), style.Background);
257
258 // Padding for text
259 var textRect = GetClientArea();
260 float textX = HorizontalTextAlignment switch
261 {
262 TextAlignment.Near => 15,
263 TextAlignment.Center => 5,
264 TextAlignment.Far => -5,
265 _ => throw new ArgumentOutOfRangeException()
266 };
267 textRect.X += textX;
268 textRect.Width -= 10;
269
270 // Tooltip text
271 Render2D.DrawText(
272 style.FontMedium,
273 _currentText,
274 textRect,
275 style.Foreground,
276 HorizontalTextAlignment,
277 TextAlignment.Center,
278 TextWrapping.WrapWords
279 );
280 }
281
282 /// <inheritdoc />
283 protected override void PerformLayoutBeforeChildren()

Callers 2

DrawChildrenMethod · 0.45
DrawChildrenMethod · 0.45

Calls 3

FillRectangleMethod · 0.80
LerpMethod · 0.45
DrawTextMethod · 0.45

Tested by

no test coverage detected