@@ -172,39 +172,34 @@ GameEngine::GameEngine() : dictionary(nullptr) {
172172 { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT , 0 , " No" },
173173 };
174174
175- const SDL_MessageBoxColorScheme colorScheme = {
176- {
177- /* [SDL_MESSAGEBOX_COLOR_BACKGROUND] */
178- { 35 , 35 , 35 }, // Dark Grey
179- /* [SDL_MESSAGEBOX_COLOR_TEXT] */
180- { 240 , 240 , 240 }, // Off-White
181- /* [SDL_MESSAGEBOX_COLOR_BUTTON_BORDER] */
182- { 255 , 100 , 100 }, // Warning Red/Orange
183- /* [SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND] */
184- { 60 , 60 , 60 }, // Lighter Grey
185- /* [SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED] */
186- { 200 , 60 , 60 } // Dark Red/Orange when hovered/selected
187- }
188- };
189-
190- const SDL_MessageBoxData messageboxdata = {
191- SDL_MESSAGEBOX_WARNING ,
192- nullptr ,
193- " Security Warning: Untrusted Author" ,
194- message.c_str (),
195- SDL_arraysize (buttons),
196- buttons,
197- &colorScheme
198- };
175+ const SDL_MessageBoxColorScheme colorScheme = { {
176+ /* [SDL_MESSAGEBOX_COLOR_BACKGROUND] */
177+ { 35 , 35 , 35 }, // Dark Grey
178+ /* [SDL_MESSAGEBOX_COLOR_TEXT] */
179+ { 240 , 240 , 240 }, // Off-White
180+ /* [SDL_MESSAGEBOX_COLOR_BUTTON_BORDER] */
181+ { 255 , 100 , 100 }, // Warning Red/Orange
182+ /* [SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND] */
183+ { 60 , 60 , 60 }, // Lighter Grey
184+ /* [SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED] */
185+ { 200 , 60 , 60 } // Dark Red/Orange when hovered/selected
186+ } };
187+
188+ const SDL_MessageBoxData messageboxdata = { SDL_MESSAGEBOX_WARNING ,
189+ nullptr ,
190+ " Security Warning: Untrusted Author" ,
191+ message.c_str (),
192+ SDL_arraysize (buttons),
193+ buttons,
194+ &colorScheme };
199195
200196 int buttonid;
201197 if (SDL_ShowMessageBox (&messageboxdata, &buttonid) < 0 ) {
202198 return false ;
203199 }
204200
205201 return buttonid == 1 ;
206- }
207- );
202+ });
208203
209204 gsFast3dWindow = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
210205 this ->context ->InitWindow (gsFast3dWindow);
@@ -955,45 +950,42 @@ void GameEngine::LoadScripts() {
955950 auto scripting = Ship::Context::GetInstance ()->GetScriptSystem ();
956951 Notification::Emit (
957952 { .message = " Loading mods this may take a while..." , .remainingTime = (totalScripts * 5 .0f ), .mute = true });
958- static std::shared_ptr<BS ::thread_pool> mThreadPool = std::make_shared<BS ::thread_pool>(1 );
959- mThreadPool ->submit_task ([&]() -> void {
960- auto currentScriptName = std::make_shared<std::string>(" " );
961- auto currentScript = std::make_shared<std::atomic<int >>(0 );
962- auto notification = std::make_shared<Notification::Options>();
963- notification->mute = true ;
964- notification->remainingTime = 7 .0f ;
965- try {
966- scripting->CompileAll ([&](const std::shared_ptr<Ship::Archive>& archive) {
967- if (!archive)
968- return ;
969-
970- auto & info = archive->GetManifest ();
971- *currentScriptName = info.Name ;
972- int scriptNum = ++(*currentScript);
973-
974- notification->message =
975- fmt::format (" Loading {} ({}/{})" , *currentScriptName, scriptNum, this ->totalScripts );
976-
977- Notification::Emit (*notification);
978- });
979- } catch (std::exception& e) {
953+ auto currentScriptName = std::make_shared<std::string>(" " );
954+ auto currentScript = std::make_shared<std::atomic<int >>(0 );
955+ auto notification = std::make_shared<Notification::Options>();
956+ notification->mute = true ;
957+ notification->remainingTime = 7 .0f ;
958+ try {
959+ scripting->CompileAll ([&](const std::shared_ptr<Ship::Archive>& archive) {
960+ if (!archive)
961+ return ;
962+
963+ auto & info = archive->GetManifest ();
964+ *currentScriptName = info.Name ;
965+ int scriptNum = ++(*currentScript);
966+
980967 notification->message =
981- fmt::format (" Failed to build {} ({}/{})" , *currentScriptName, (*currentScript + 1 ) , this ->totalScripts );
982- SPDLOG_ERROR ( " Failed to build script {}: {} " , *currentScriptName, e. what ());
968+ fmt::format (" Loading {} ({}/{})" , *currentScriptName, scriptNum , this ->totalScripts );
969+
983970 Notification::Emit (*notification);
984- }
971+ });
972+ } catch (std::exception& e) {
973+ notification->message =
974+ fmt::format (" Failed to build {} ({}/{})" , *currentScriptName, (*currentScript + 1 ), this ->totalScripts );
975+ SPDLOG_ERROR (" Failed to build script {}: {}" , *currentScriptName, e.what ());
976+ Notification::Emit (*notification);
977+ }
985978
986- try {
987- context->GetScriptSystem ()->LoadAll ();
988- Notification::Emit ({ .message = " Finished loading mods!" , .remainingTime = 5 .0f , .mute = true });
989- } catch (std::exception& e) {
990- SPDLOG_ERROR (" Failed to load scripts: {}" , e.what ());
991- Notification::Emit ({ .message = " Failed to load some mods, check logs for details." ,
992- .messageColor = ImVec4 (1 .0f , 0 .5f , 0 .5f , 1 .0f ),
993- .remainingTime = 5 .0f ,
994- .mute = true });
995- }
996- });
979+ try {
980+ context->GetScriptSystem ()->LoadAll ();
981+ Notification::Emit ({ .message = " Finished loading mods!" , .remainingTime = 5 .0f , .mute = true });
982+ } catch (std::exception& e) {
983+ SPDLOG_ERROR (" Failed to load scripts: {}" , e.what ());
984+ Notification::Emit ({ .message = " Failed to load some mods, check logs for details." ,
985+ .messageColor = ImVec4 (1 .0f , 0 .5f , 0 .5f , 1 .0f ),
986+ .remainingTime = 5 .0f ,
987+ .mute = true });
988+ }
997989}
998990
999991void GameEngine::Create (int argc, char * argv[]) {
0 commit comments