@@ -24,6 +24,9 @@ Index of this file:
2424
2525#include " editor.h"
2626
27+ PL_API void pl_load_ext (plApiRegistryI* ptApiRegistry, bool bReload);
28+ PL_API void pl_unload_ext (plApiRegistryI* ptApiRegistry, bool bReload);
29+
2730// -----------------------------------------------------------------------------
2831// [SECTION] pl_app_load
2932// -----------------------------------------------------------------------------
@@ -104,9 +107,10 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
104107 const plExtensionRegistryI* ptExtensionRegistry = pl_get_api_latest (ptApiRegistry, plExtensionRegistryI);
105108
106109 // load extensions
107- ptExtensionRegistry->load (" pl_unity_ext" , nullptr , nullptr , true );
108- ptExtensionRegistry->load (" pl_platform_ext" , " pl_load_platform_ext" , " pl_unload_platform_ext" , false );
109- ptExtensionRegistry->load (" pl_dear_imgui_ext" , " pl_load_dear_imgui_ext" , " pl_unload_dear_imgui_ext" , false );
110+ pl_load_ext (ptApiRegistry, false );
111+ pl_load_platform_ext (ptApiRegistry, false );
112+ pl_load_dear_imgui_ext (ptApiRegistry, false );
113+ // ptExtensionRegistry->load("pl_dear_imgui_ext", "pl_load_dear_imgui_ext", "pl_unload_dear_imgui_ext", false);
110114
111115 // load apis
112116 gptWindows = pl_get_api_latest (ptApiRegistry, plWindowI);
@@ -194,10 +198,10 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
194198 gptWindows->create (tWindowDesc, &ptAppData->ptWindow );
195199 gptWindows->show (ptAppData->ptWindow );
196200
197- plFullScreenDesc tFullScreen = {};
198- tFullScreen.iMonitor = 1 ;
199- tFullScreen.tMode = PL_FULLSCREEN_MODE_EXCLUSIVE;
200- gptWindows->set_fullscreen (ptAppData->ptWindow , &tFullScreen);
201+ // plFullScreenDesc tFullScreen = {};
202+ // tFullScreen.iMonitor = 1;
203+ // tFullScreen.tMode = PL_FULLSCREEN_MODE_EXCLUSIVE;
204+ // gptWindows->set_fullscreen(ptAppData->ptWindow, &tFullScreen);
201205
202206 plStarterInit tStarterInit = {};
203207 tStarterInit.tFlags = PL_STARTER_FLAGS_NONE;
@@ -317,7 +321,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
317321
318322 pl__find_models (ptAppData);
319323
320- gptDearImGui-> initialize (ptAppData->ptDevice , gptStarter->get_swapchain (), gptStarter->get_render_pass ());
324+ pl_dear_imgui_initialize (ptAppData->ptDevice , gptStarter->get_swapchain (), gptStarter->get_render_pass ());
321325 // ImGui::GetIO().ConfigFlags &= ~ImGuiBackendFlags_PlatformHasViewports;
322326 ImPlot::SetCurrentContext ((ImPlotContext*)ptDataRegistry->get_data (" implot" ));
323327 ImGuiIO& tImGuiIO = ImGui::GetIO ();
@@ -342,9 +346,9 @@ pl_app_shutdown(plAppData* ptAppData)
342346 pl_sb_free (ptAppData->sbcTempBuffer );
343347
344348 // ensure GPU is finished before cleanup
345- gptGfx-> flush_device (ptAppData->ptDevice );
349+ pl_graphics_flush_device (ptAppData->ptDevice );
346350
347- gptDearImGui-> cleanup ();
351+ pl_dear_imgui_cleanup ();
348352
349353 gptConfig->set_bool (" bShowEntityWindow" , ptAppData->bShowEntityWindow );
350354 gptConfig->set_bool (" bPhysicsDebugDraw" , ptAppData->bPhysicsDebugDraw );
@@ -406,7 +410,7 @@ pl_app_update(plAppData* ptAppData)
406410
407411 gptRenderer->begin_frame ();
408412
409- gptDearImGui-> new_frame (ptAppData->ptDevice , gptStarter->get_render_pass ());
413+ pl_dear_imgui_new_frame (ptAppData->ptDevice , gptStarter->get_render_pass ());
410414
411415 if (ptAppData->bResize )
412416 {
@@ -489,7 +493,7 @@ pl_app_update(plAppData* ptAppData)
489493
490494 if (ptAppData->bShowEntityWindow )
491495 {
492- if (gptEcsTools->show_ecs_window (ptAppData->ptCompLibrary , &ptAppData->tSelectedEntity , ptAppData->ptScene , &ptAppData->bShowEntityWindow ))
496+ if (gptEcsTools->show_window (ptAppData->ptCompLibrary , &ptAppData->tSelectedEntity , ptAppData->ptScene , &ptAppData->bShowEntityWindow ))
493497 {
494498 if (ptAppData->tSelectedEntity .uData == UINT64_MAX)
495499 {
@@ -713,7 +717,7 @@ pl_app_update(plAppData* ptAppData)
713717
714718 plVec2 tUV = {};
715719 plBindGroupHandle tTextureHandle = gptRenderer->get_view_texture (ptAppData->ptView , &tUV);
716- ImTextureRef tTexture = ImTextureRef (gptDearImGui-> get_texture_id_from_bindgroup (ptAppData->ptDevice , tTextureHandle));
720+ ImTextureRef tTexture = ImTextureRef (pl_dear_imgui_get_texture_id_from_bindgroup (ptAppData->ptDevice , tTextureHandle));
717721 ImGui::Image (tTexture, tContextSize, ImVec2 (0 , 0 ), ImVec2 (tUV.x , tUV.y ));
718722
719723 }
@@ -730,7 +734,7 @@ pl_app_update(plAppData* ptAppData)
730734 ImVec2 tContextSize = ImGui::GetContentRegionAvail ();
731735 gptCamera->set_aspect ((plCamera*)gptEcs->get_component (ptAppData->ptCompLibrary , gptCamera->get_ecs_type_key (), ptAppData->tSecondaryCamera ), tContextSize.x / tContextSize.y );
732736
733- ImTextureRef tTexture = ImTextureRef (gptDearImGui-> get_texture_id_from_bindgroup (ptAppData->ptDevice , tTextureHandle));
737+ ImTextureRef tTexture = ImTextureRef (pl_dear_imgui_get_texture_id_from_bindgroup (ptAppData->ptDevice , tTextureHandle));
734738 ImGui::Image (tTexture, tContextSize, ImVec2 (0 , 0 ), ImVec2 (tUV.x , tUV.y ));
735739 }
736740 ImGui::End ();
@@ -743,12 +747,12 @@ pl_app_update(plAppData* ptAppData)
743747 ImGui::ShowDemoWindow (&ptAppData->bShowImGuiDemo );
744748
745749 plRenderEncoder* ptRenderEncoder = gptStarter->begin_main_pass ();
746- gptDearImGui-> render (ptRenderEncoder, gptGfx-> get_encoder_command_buffer (ptRenderEncoder));
750+ pl_dear_imgui_render (ptRenderEncoder, pl_graphics_get_encoder_command_buffer (ptRenderEncoder));
747751
748752 float fWidth = ptIO->tMainViewportSize .x ;
749753 float fHeight = ptIO->tMainViewportSize .y ;
750754 plDrawList2D* ptMessageDrawlist = gptScreenLog->get_drawlist (tLogOffset.x , tLogOffset.y , fWidth * 0 .2f , fHeight );
751- gptDraw->submit_2d_drawlist (ptMessageDrawlist, ptRenderEncoder, fWidth , fHeight , gptGfx-> get_swapchain_info (gptStarter->get_swapchain ()).tSampleCount );
755+ gptDraw->submit_2d_drawlist (ptMessageDrawlist, ptRenderEncoder, fWidth , fHeight , pl_graphics_get_swapchain_info (gptStarter->get_swapchain ()).tSampleCount );
752756 gptStarter->end_main_pass ();
753757 pl_end_cpu_sample (gptProfile, 0 );
754758 gptStarter->end_frame ();
@@ -952,7 +956,7 @@ pl__show_editor_window(plAppData* ptAppData)
952956 if (ImGui::CollapsingHeader (ICON_FA_CIRCLE_INFO " Information" ))
953957 {
954958 ImGui::Text (" Pilot Light %s" , PILOT_LIGHT_VERSION_STRING);
955- ImGui::Text (" Graphics Backend: %s" , gptGfx-> get_backend_string ());
959+ ImGui::Text (" Graphics Backend: %s" , pl_graphics_get_backend_string ());
956960 if (ImGui::Button (" Show Camera Controls" ))
957961 {
958962 const char * acMouseInfo = " Camera Controls\n "
@@ -1277,7 +1281,8 @@ pl__show_editor_window(plAppData* ptAppData)
12771281
12781282 if (ImGui::CollapsingHeader (ICON_FA_BOXES_STACKED " Physics" , 0 ))
12791283 {
1280- plPhysicsEngineSettings tPhysicsSettings = gptPhysics->get_settings ();
1284+ plPhysicsEngineSettings tPhysicsSettings = {};
1285+ gptPhysics->get_settings (&tPhysicsSettings);
12811286
12821287 ImGui::Checkbox (" Enabled" , &tPhysicsSettings.bEnabled );
12831288 ImGui::Checkbox (" Debug Draw" , &ptAppData->bPhysicsDebugDraw );
0 commit comments