MCPcopy Create free account
hub / github.com/chrxh/alien / drawLoadingScreen

Method drawLoadingScreen

source/Gui/MainLoopController.cpp:275–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void MainLoopController::drawLoadingScreen()
276{
277 //background color
278 glClearColor(0, 0, 0.1f, 1.0f);
279 glClear(GL_COLOR_BUFFER_BIT);
280
281 auto& styleRep = StyleRepository::get();
282 auto center = ImGui::GetMainViewport()->GetCenter();
283 auto bottom = ImGui::GetMainViewport()->Pos.y + ImGui::GetMainViewport()->Size.y;
284 ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
285 auto imageScale = scale(1.0f);
286 ImGui::SetNextWindowSize(ImVec2(_logo.width * imageScale + 10.0f, _logo.height * imageScale + 10.0f));
287
288 ImGuiWindowFlags windowFlags = 0 | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove
289 | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoBackground;
290 ImGui::Begin("##startup", NULL, windowFlags);
291 ImGui::Image((void*)(intptr_t)_logo.textureId, ImVec2(_logo.width * imageScale, _logo.height * imageScale));
292 ImGui::End();
293
294 ImDrawList* drawList = ImGui::GetBackgroundDrawList();
295 ImColor textColor = Const::ProgramVersionTextColor;
296 textColor.Value.w *= ImGui::GetStyle().Alpha;
297
298 drawList->AddText(styleRep.getReefLargeFont(), scale(48.0f), {center.x - scale(175), bottom - scale(200)}, textColor, "Artificial Life Environment");
299
300 auto versionString = "Version " + Const::ProgramVersion;
301 drawList->AddText(
302 styleRep.getReefMediumFont(),
303 scale(24.0f),
304 {center.x - scale(toFloat(versionString.size()) * 3.4f), bottom - scale(140)},
305 textColor,
306 versionString.c_str());
307
308 if (GlobalSettings::get().isDebugMode()) {
309 drawList->AddText(
310 styleRep.getReefMediumFont(),
311 scale(24.0f),
312 {center.x - scale(24.0f), bottom - scale(100)},
313 textColor,
314 "DEBUG");
315 }
316}
317
318void MainLoopController::decreaseAlphaForFadeOutLoadingScreen()
319{

Callers

nothing calls this directly

Calls 7

ImVec2Class · 0.85
scaleFunction · 0.85
toFloatFunction · 0.85
getReefLargeFontMethod · 0.80
getReefMediumFontMethod · 0.80
sizeMethod · 0.80
isDebugModeMethod · 0.80

Tested by

no test coverage detected