add debug start screen ui + can load plugins

This commit is contained in:
2023-08-03 13:05:19 +02:00
parent 5547ff6d2b
commit c9672bf352
4 changed files with 74 additions and 4 deletions

View File

@ -6,7 +6,7 @@
#include <memory>
MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path) :
MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::vector<std::string> plugins) :
renderer(renderer_),
rmm(cr),
mts(rmm),
@ -42,6 +42,7 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path) :
g_provideInstance<ToxI>("ToxI", "host", &tc);
g_provideInstance<ToxEventProviderI>("ToxEventProviderI", "host", &tc);
g_provideInstance<ToxContactModel2>("ToxContactModel2", "host", &tcm);
// TODO: pm?
@ -50,6 +51,14 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path) :
g_provideInstance<TextureUploaderI>("TextureUploaderI", "host", &sdlrtu);
}
for (const auto& ppath : plugins) {
if (!pm.add(ppath)) {
std::cerr << "MS error: loading plugin '" << ppath << "' failed!\n";
// thow?
assert(false && "failed to load plugin");
}
}
conf.dump();
}