Open prabuinet opened 1 month ago
Hi!
It depends on what do you want to have.
If you want to run your agents on a separate work thread then it's enough to use so_5::wrapped_env_t
before your GUI-handling loop. Something like that:
so_5::wrapped_env_t sobjectizer{ ... };
bool done = false;
while (!done)
{
... // Handling of GUI events and refreshing UI
}
If you need to send some information from your agents to the main thread, then mchains can be used:
so_5::wrapped_env_t sobjectizer{...};
auto data_mchain = so_5::create_mchain(sobjectizer);
... // Registration of some agents and passing data_mchain to them.
bool done = false;
while (!done)
{
// Reading data from mchain.
so_5::receive(so_5::from(data_mchain).total_time(5ms), ...);
... // Handling of GUI events and refreshing UI
}
If you want to run your agents on the main thread it's also possible, but requires a special dispatcher implementation that will contain main GUI-loop inside.
It will be helpful if someone drop an example on how to integerate this with a GUI app (for example IMGUI).
Any pointers or links will also be fine.
I believe it has to do something with the main loop: ... [below is example of imgui/sdl2 main loop]
Thanks