I am writing a game in C++ using EnTT (ECS framework)
My game is designed in simple concepts like Logic UI and Game which controls this two.
So I have struct like this
struct Game { // The logic Logic logic; // Ui Ui ui; } I am using delegates to fire events from one concept to another for example.
struct Logic { void doSomeCalculations(){ ... elementSpawned(someElement); ... } } And in Game part I implement this
struct Game { ... void onElementSpawned(someElement){ } } Now let's say spawning element does some animation.
So I need to stop the logic for a while do the animation and then continue, because Logic can go too far with calculations why UI is animating./
So I need to implement something like this
void onElementSpawned(someElement) { logic.wait(); ui.doAnimation(someElement); logic.resume(); } How can I achieve this?
https://stackoverflow.com/questions/67293630/c-game-logic-ui-synchronization-with-threads April 28, 2021 at 12:06PM
没有评论:
发表评论