RtB/STATES

12 lines
999 B
Plaintext

States
----------------
States are the manner through which the program's behavioral logic is divided. Each State refers to and communicates to the services provided by Core.
Within Core, a list of states is kept. Only the top-most state is considered as active and processed.
Each state must be capable of releasing resources and reacquiring resources when activated or deactivated. These functions are:
* onRise - called on activation, reacquires resources such as textures, vbos, sound assets, etc.
* onCede - called on deactivation, frees loaded resources
This functionality is for two reasons. The first is that it allows efficient resource usage on all platforms by freeing or releasing resources that are no longer immediately used while also being capable of swiftly reloading resources when a state is reactivated. The second reason is for mobile platforms, as platforms such as iOS require portions of the OpenGL environment to be freed when the application goes to the background.