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

Method Show

Source/Editor/Windows/SplashScreen.cpp:150–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void SplashScreen::Show()
151{
152 // Skip if already shown or in headless mode
153 if (IsVisible() || CommandLine::Options.Headless.IsTrue())
154 return;
155
156 LOG(Info, "Showing splash screen");
157
158 // Create window
159 const float dpiScale = Platform::GetDpiScale();
160 CreateWindowSettings settings;
161 settings.Title = TEXT("Flax Editor");
162 settings.Size.X = 500 * dpiScale;
163 settings.Size.Y = 170 * dpiScale;
164 settings.HasBorder = false;
165 settings.AllowInput = true;
166 settings.AllowMinimize = false;
167 settings.AllowMaximize = false;
168 settings.AllowDragAndDrop = false;
169 settings.IsTopmost = false;
170 settings.Type = WindowType::Utility;
171 settings.HasSizingFrame = false;
172 settings.ShowAfterFirstPaint = true;
173 settings.StartPosition = WindowStartPosition::CenterScreen;
174 _window = Platform::CreateWindow(settings);
175
176 // Register window events
177 _window->Closing.Bind([](ClosingReason reason, bool& cancel)
178 {
179 // Disable closing by user
180 if (reason == ClosingReason::User)
181 cancel = true;
182 });
183 _window->HitTest.Bind([](const Float2& mouse, WindowHitCodes& hit, bool& handled)
184 {
185 // Allow to drag window by clicking anywhere
186 hit = WindowHitCodes::Caption;
187 handled = true;
188 });
189 _window->Shown.Bind<SplashScreen, &SplashScreen::OnShown>(this);
190 _window->Draw.Bind<SplashScreen, &SplashScreen::OnDraw>(this);
191
192 // Setup
193 _dpiScale = dpiScale;
194 _size = settings.Size;
195 _startTime = DateTime::NowUTC();
196 auto str = Globals::ProjectFolder;
197#if PLATFORM_WIN32
198 str.Replace('/', '\\');
199#else
200 str.Replace('\\', '/');
201#endif
202 _infoText = String::Format(TEXT("Flax Editor {0}\n{1}\nProject: {2}"), TEXT(FLAXENGINE_VERSION_TEXT), TEXT(FLAXENGINE_COPYRIGHT), str);
203 _quote = SplashScreenQuotes[rand() % ARRAY_COUNT(SplashScreenQuotes)];
204
205 // Load font
206 auto font = Content::LoadAsyncInternal<FontAsset>(TEXT("Editor/Fonts/Roboto-Regular"));
207 if (font == nullptr)

Callers 15

EndInitMethod · 0.45
NewProjectMethod · 0.45
OpenProjectMethod · 0.45
BuildScenesOrCancelMethod · 0.45
InitMethod · 0.45
ShowSourceCodeWindowMethod · 0.45
CheckSaveBeforeCloseMethod · 0.45
ShowSearchMethod · 0.45
ShowFinderMethod · 0.45
LoadLayoutMethod · 0.45
LoadPanelMethod · 0.45
OnSubmitMethod · 0.45

Calls 7

GetDpiScaleFunction · 0.85
randClass · 0.85
ReplaceMethod · 0.80
FormatFunction · 0.50
IsTrueMethod · 0.45
BindMethod · 0.45
IsLoadedMethod · 0.45

Tested by

no test coverage detected