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

Method OnDraw

Source/Editor/Windows/SplashScreen.cpp:251–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void SplashScreen::OnDraw()
252{
253 const float s = _dpiScale;
254 const float width = _size.X;
255 const float height = _size.Y;
256
257 // Peek time
258 const float time = static_cast<float>((DateTime::NowUTC() - _startTime).GetTotalSeconds());
259
260 // Background
261 float lightBarHeight = 112 * s;
262 if (_splashTexture != nullptr)
263 {
264 if (_splashTexture->IsLoaded())
265 {
266 lightBarHeight = height - lightBarHeight + 20 * s;
267 Render2D::DrawTexture(_splashTexture, Rectangle(0, 0, width, height));
268 Color rectColor = Color::FromRGB(0x0C0C0C);
269 Render2D::FillRectangle(Rectangle(0, lightBarHeight, width, height - lightBarHeight),rectColor.AlphaMultiplied(0.85f), rectColor.AlphaMultiplied(0.85f), rectColor, rectColor);
270 }
271 }
272 else
273 {
274 Render2D::FillRectangle(Rectangle(0, 0, width, 150 * s), Color::FromRGB(0x1C1C1C));
275 Render2D::FillRectangle(Rectangle(0, lightBarHeight, width, height), Color::FromRGB(0x0C0C0C));
276 }
277
278 // Animated border
279 const float anim = Math::Sin(time * 4.0f) * 0.5f + 0.5f;
280 Render2D::DrawRectangle(Rectangle(0, 0, width, height), Math::Lerp(Color::Gray * 0.8f, Color::FromRGB(0x007ACC), anim));
281
282 // Check fonts
283 if (!HasLoadedFonts())
284 return;
285
286 // Title
287 const auto titleLength = _titleFont->MeasureText(GetTitle());
288 TextLayoutOptions layout;
289 layout.Bounds = Rectangle(10 * s, 10 * s, width - 10 * s, 50 * s);
290 layout.HorizontalAlignment = TextAlignment::Near;
291 layout.VerticalAlignment = TextAlignment::Near;
292 layout.Scale = Math::Min((width - 20 * s) / titleLength.X, 1.0f);
293 Render2D::DrawText(_titleFont, GetTitle(), Color::White, layout);
294
295 // Subtitle
296 String subtitle(_quote);
297 if (!subtitle.EndsWith(TEXT('!')) && !subtitle.EndsWith(TEXT('?')))
298 {
299 for (int32 i = static_cast<int32>(time * 2.0f) % 4; i > 0; i--)
300 subtitle += TEXT('.');
301 for (int32 i = 0; i < 4 - static_cast<int32>(time * 2.0f) % 4; i++)
302 subtitle += TEXT(' ');
303 }
304 if (_splashTexture != nullptr)
305 {
306 layout.Bounds = Rectangle(width - 224 * s, lightBarHeight + 4 * s, 220 * s, 35 * s);
307 layout.VerticalAlignment = TextAlignment::Near;
308 }

Callers 10

OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnThumbnailDrawBeginMethod · 0.45
OnCollectDrawCallsMethod · 0.45
OnCollectDrawCallsMethod · 0.45

Calls 11

FromRGBFunction · 0.85
DrawRectangleFunction · 0.85
GetTitleFunction · 0.85
AlphaMultipliedMethod · 0.80
MeasureTextMethod · 0.80
RectangleClass · 0.50
SinFunction · 0.50
LerpFunction · 0.50
MinFunction · 0.50
IsLoadedMethod · 0.45
EndsWithMethod · 0.45

Tested by

no test coverage detected