put font initializer on main thread so init text can be immediately rendered and fonts added more easily

This commit is contained in:
Turanszki Janos
2025-06-16 08:25:03 +02:00
parent 469197ede2
commit 24abcd840f
3 changed files with 8 additions and 9 deletions
+5 -8
View File
@@ -320,6 +320,11 @@ void Editor::Initialize()
//infoDisplay.heap_allocation_counter = true;
//infoDisplay.vram_usage = true;
// Font icon is from #include "FontAwesomeV6.h"
// We will not directly use this font style, but let the font renderer fall back on it
// when an icon character is not found in the default font.
wi::font::AddFontStyle("FontAwesomeV6", font_awesome_v6, font_awesome_v6_size);
if (!IsScriptReplacement()) // we only activate editor functionality if this exe does not have a script replacement
{
renderComponent.main = this;
@@ -1400,14 +1405,6 @@ void EditorComponent::Load()
}
void EditorComponent::Start()
{
// Start() is called after system initialization is complete, while Load() can be while initialization is still not finished
// Therefore we initialize things in Start which would need to be after system initializations:
// Font icon is from #include "FontAwesomeV6.h"
// We will not directly use this font style, but let the font renderer fall back on it
// when an icon character is not found in the default font.
wi::font::AddFontStyle("FontAwesomeV6", font_awesome_v6, font_awesome_v6_size);
// Add other fonts that were loaded from fonts directory as fallback fonts:
for (auto& x : font_datas)
{
+2
View File
@@ -502,6 +502,8 @@ void ProjectCreatorWindow::Render(const wi::Canvas& canvas, wi::graphics::Comman
{
wi::gui::Window::Render(canvas, cmd);
if (!IsVisible())
return;
wi::gui::Window::ApplyScissor(canvas, scissorRect, cmd);
wi::image::Params fx;
fx.pos.x = cursorButton.GetPos().x + cursorButton.GetSize().x * hotspotX;
+1 -1
View File
@@ -128,7 +128,6 @@ namespace wi::initializer
wi::jobsystem::Initialize();
wi::backlog::post("");
wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args) { wi::font::Initialize(); systems[INITIALIZED_SYSTEM_FONT].store(true); });
wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args) { wi::image::Initialize(); systems[INITIALIZED_SYSTEM_IMAGE].store(true); });
wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args) { wi::input::Initialize(); systems[INITIALIZED_SYSTEM_INPUT].store(true); });
wi::jobsystem::Execute(ctx, [](wi::jobsystem::JobArgs args) { wi::renderer::Initialize(); systems[INITIALIZED_SYSTEM_RENDERER].store(true); });
@@ -144,6 +143,7 @@ namespace wi::initializer
// Initialize these immediately:
wi::lua::Initialize(); systems[INITIALIZED_SYSTEM_LUA].store(true);
wi::audio::Initialize(); systems[INITIALIZED_SYSTEM_AUDIO].store(true);
wi::font::Initialize(); systems[INITIALIZED_SYSTEM_FONT].store(true);
std::thread([] {
wi::jobsystem::Wait(ctx);