AODQ / pulchritude-engine

lingua franca game engine
MIT License
0 stars 0 forks source link

PulcApp - allow modules to exit the application #4

Open AODQ opened 2 years ago

AODQ commented 2 years ago

Currently modules can only exit with C 'exit' (or similar). There is no proper shutdown as a result and thus memory-leak operations can't be processed. We need to exit gracefully; there are a few options here:

typdef enum {
  PulcComponentShouldExit_Yes,
  PulcComponentShouldExit_No,
} PulcComponentShouldExit;

PulcComponentShouldExit pulcComponentShouldExit();

or

PulcComponentShouldExit pulcComponentUpdate);

The advantage of the latter is that it simplifies logic processing (no need to store some static variable); the advantage of the former is it lets observer/event-based plugins (those that don't provide an update) to exit the program. I think both are viable options, as the pulcComponentShouldExit can be an optional function.