more sync code
This commit is contained in:
@ -31,24 +31,29 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
}
|
||||
|
||||
//ConfigModelI* conf = nullptr;
|
||||
Contact3Registry* cr = nullptr;
|
||||
|
||||
{ // make sure required types are loaded
|
||||
//conf = RESOLVE_INSTANCE(ConfigModelI);
|
||||
cr = RESOLVE_INSTANCE(Contact3Registry);
|
||||
|
||||
//if (conf == nullptr) {
|
||||
//std::cerr << "PLUGIN CRDTN missing ConfigModelI\n";
|
||||
//return 2;
|
||||
//}
|
||||
|
||||
if (cr == nullptr) {
|
||||
std::cerr << "PLUGIN CRDTNTS missing Contact3Registry\n";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_crdtn = std::make_unique<CRDTNotes>(/**conf*/);
|
||||
g_crdtns = std::make_unique<CRDTNotesSync>(/**conf*/);
|
||||
g_crdtn = std::make_unique<CRDTNotes>();
|
||||
g_crdtns = std::make_unique<CRDTNotesSync>(*g_crdtn, *cr);
|
||||
|
||||
// register types
|
||||
PROVIDE_INSTANCE(CRDTNotes, "CRDTNotes", g_crdtn.get());
|
||||
|
||||
PROVIDE_INSTANCE(CRDTNotesSync, "CRDTNotes", g_crdtns.get());
|
||||
PROVIDE_INSTANCE(CRDTNotesEventI, "CRDTNotes", g_crdtns.get());
|
||||
|
||||
@ -59,12 +64,13 @@ SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) {
|
||||
std::cout << "PLUGIN CRDTN STOP()\n";
|
||||
|
||||
g_crdtn.reset();
|
||||
g_crdtns.reset();
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT void solana_plugin_tick(float delta) {
|
||||
(void)delta;
|
||||
//std::cout << "PLUGIN CRDTN TICK()\n";
|
||||
//g_crdtn->iterate();
|
||||
g_crdtns->iterate(delta);
|
||||
}
|
||||
|
||||
} // extern C
|
||||
|
@ -30,13 +30,13 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
}
|
||||
|
||||
//ConfigModelI* conf = nullptr;
|
||||
CRDTNotes* crdtn = nullptr;
|
||||
CRDTNotesSync* crdtns = nullptr;
|
||||
Contact3Registry* cr = nullptr;
|
||||
ImGuiContext* imguic = nullptr;
|
||||
|
||||
{ // make sure required types are loaded
|
||||
//conf = RESOLVE_INSTANCE(ConfigModelI);
|
||||
crdtn = RESOLVE_INSTANCE(CRDTNotes);
|
||||
crdtns = RESOLVE_INSTANCE(CRDTNotesSync);
|
||||
cr = RESOLVE_INSTANCE(Contact3Registry);
|
||||
imguic = RESOLVE_INSTANCE(ImGuiContext);
|
||||
|
||||
@ -45,8 +45,8 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
//return 2;
|
||||
//}
|
||||
|
||||
if (crdtn == nullptr) {
|
||||
std::cerr << "PLUGIN CRDTNIMGUI missing CRDTNotes\n";
|
||||
if (crdtns == nullptr) {
|
||||
std::cerr << "PLUGIN CRDTNIMGUI missing CRDTNotesSync\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_crdtn_imgui = std::make_unique<CRDTNotesImGui>(*crdtn, *cr);
|
||||
g_crdtn_imgui = std::make_unique<CRDTNotesImGui>(*crdtns, *cr);
|
||||
|
||||
// register types
|
||||
PROVIDE_INSTANCE(CRDTNotesImGui, "CRDTNotesImGui", g_crdtn_imgui.get());
|
||||
|
@ -35,7 +35,6 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
}
|
||||
|
||||
//ConfigModelI* conf = nullptr;
|
||||
CRDTNotes* notes = nullptr;
|
||||
CRDTNotesEventI* notes_sync = nullptr;
|
||||
Contact3Registry* cr = nullptr;
|
||||
ToxI* t = nullptr;
|
||||
@ -44,7 +43,6 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
|
||||
{ // make sure required types are loaded
|
||||
//conf = RESOLVE_INSTANCE(ConfigModelI);
|
||||
notes = RESOLVE_INSTANCE(CRDTNotes);
|
||||
notes_sync = RESOLVE_INSTANCE(CRDTNotesEventI);
|
||||
cr = RESOLVE_INSTANCE(Contact3Registry);
|
||||
t = RESOLVE_INSTANCE(ToxI);
|
||||
@ -56,11 +54,6 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
//return 2;
|
||||
//}
|
||||
|
||||
if (notes == nullptr) {
|
||||
std::cerr << "PLUGIN CRDTNTS missing CRDTNotes\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (notes_sync == nullptr) {
|
||||
std::cerr << "PLUGIN CRDTNTS missing CRDTNotesEventI\n";
|
||||
return 2;
|
||||
@ -89,7 +82,7 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_crdtn_ts = std::make_unique<CRDTNotesToxSync>(*notes, *notes_sync, *cr, *t, *tep, *tcm);
|
||||
g_crdtn_ts = std::make_unique<CRDTNotesToxSync>(*notes_sync, *cr, *t, *tep, *tcm);
|
||||
|
||||
// register types
|
||||
PROVIDE_INSTANCE(CRDTNotesToxSync, "CRDTNotesToxSync", g_crdtn_ts.get());
|
||||
|
Reference in New Issue
Block a user