Game states and layouts management
Posted: Mon Aug 19, 2013 09:35
In my application i have several states. Some of them use CEGUI. Some of them use even more than a single layout.
I've tried multiple approaches, be it loading them when the state was entered or when it was created. All of them had some issues, probably also due of an incorrect understanding on my part (for example, loading multiple layouts on creation cancels out the one delegated to the mouse cursor (and i still don't know why); doesn't happen if i load them when entering the state, but then the application crashes when i try to destroy the windows when exiting the state).
I thought the correct way to properly deal with them was to load them (thus,create the window) everytime i enter the state, thus subscribing the related events, and deleting the window when the need to exit from the state arises. Was the assumption correct?
If so, i'll have to understand why it crashes in my case - but that can come later.
I've tried multiple approaches, be it loading them when the state was entered or when it was created. All of them had some issues, probably also due of an incorrect understanding on my part (for example, loading multiple layouts on creation cancels out the one delegated to the mouse cursor (and i still don't know why); doesn't happen if i load them when entering the state, but then the application crashes when i try to destroy the windows when exiting the state).
I thought the correct way to properly deal with them was to load them (thus,create the window) everytime i enter the state, thus subscribing the related events, and deleting the window when the need to exit from the state arises. Was the assumption correct?
If so, i'll have to understand why it crashes in my case - but that can come later.