CEGUI Manager Class
Posted: Mon Jul 12, 2010 12:42
So I was working on a game to kind of learn Ogre more in depth for quite a while. I recently started rewriting it from scratch to clean it up better, and along with this I decided to switch from Canvas to CEGUI. I managed to get some buttons and what not working, and it was quite a bit easier than I assumed. (Feature filled packages usually have quite a learning curve)
Anyways, I am trying to keep everything wrapped up nice and organized this go around, and I wanted to create a GUI Manager class to kind of handle everything. I am still fairly new, so these might be really stupid questions but here goes...
1) I obviously have state management in my application (login screen state, game state, etc). Im wondering if CEGUI has a feature to destroy all existing GUI elements, or if I should just destroy the CEGUI instance when changing states? The first seems much more efficient (keeping the singleton ptr for CEGUI persistent through the life of the application rather than destroying/recreating it to clean up between state switches. What would the recommendation be for this?
2) Canvas didn't really support loading layouts/schemes/etc from XML/LUA so this is a bit new to me. Is the general approach to just hardcode in the GUI elements that won't be changing, such as the main game screen, and use lua script for the others to make quick modifications? Or when using LUA, do most people just use it for everything instead of breaking it up?
3) This is more of a generic question, but as I mentioned wanting to have a little wrapper for CEGUI just for personal organization and what not, what else besides the basics (init/destroy functions, etc) would possibly be suggested as going in there? I still have some reading to do, especially since everything GUI related is revolving around the Canvas approach.
Anyways, I am trying to keep everything wrapped up nice and organized this go around, and I wanted to create a GUI Manager class to kind of handle everything. I am still fairly new, so these might be really stupid questions but here goes...
1) I obviously have state management in my application (login screen state, game state, etc). Im wondering if CEGUI has a feature to destroy all existing GUI elements, or if I should just destroy the CEGUI instance when changing states? The first seems much more efficient (keeping the singleton ptr for CEGUI persistent through the life of the application rather than destroying/recreating it to clean up between state switches. What would the recommendation be for this?
2) Canvas didn't really support loading layouts/schemes/etc from XML/LUA so this is a bit new to me. Is the general approach to just hardcode in the GUI elements that won't be changing, such as the main game screen, and use lua script for the others to make quick modifications? Or when using LUA, do most people just use it for everything instead of breaking it up?
3) This is more of a generic question, but as I mentioned wanting to have a little wrapper for CEGUI just for personal organization and what not, what else besides the basics (init/destroy functions, etc) would possibly be suggested as going in there? I still have some reading to do, especially since everything GUI related is revolving around the Canvas approach.