AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzResources.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CZ_RESOURCES_H_)
00015 #define _CZ_RESOURCES_H_
00016 
00017 
00018 #include "CzString.h"
00019 #include "CzUtil.h"
00020 #include "CzXoml.h"
00021 #include "CzScript.h"
00022 #include "CzTimer.h"
00023 
00024 class CzActionsManager;
00025 class CzAnimTimelinesManager;
00026 class CzProgramManager;
00027 class IzScriptEngine;
00028 
00029 /**
00030  @addtogroup Core
00031  @{
00032  */
00033  
00034 /*
00035 // TODO: Move this somewhere else
00036 // 
00037 // 
00038 //
00039 //
00040 // CzResourceGroup - Wrapper class to allow Marmalade resource groups to be used as game resources
00041 // 
00042 // 
00043 // 
00044 //
00045 class CzResourceGroup : public IzXomlResource
00046 {
00047     // Properties
00048 protected:
00049     CzString                    GroupFilename;          // Resource group file name
00050     void*                       ResourceGroup;          // Marmalade resource group
00051     bool                        Loaded;                 // Loaded state of resource group
00052 public:
00053     void                        setGroupFilename(const char* group_file_name)   { GroupFilename = group_file_name; }
00054     CzString&                   getGroupFilename()                              { return GroupFilename; }
00055     void*                       getResourceGroup();
00056     // Properties End
00057 
00058 public:
00059     CzResourceGroup() : IzXomlResource(), ResourceGroup(NULL), Loaded(false) { setClassType("resourcegroup"); }
00060     virtual ~CzResourceGroup() { Destroy(); }
00061 
00062     bool                        Load();
00063     void                        Destroy();
00064 
00065     // Implementation of IzXomlClass interface
00066     int                         LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node);
00067 };
00068 
00069 //
00070 //
00071 //
00072 //
00073 //  CzResourceGroupCreator - Creates an instance of a resource group ovject
00074 //
00075 //
00076 //
00077 //
00078 class CzResourceGroupCreator : public IzXomlClassCreator
00079 {
00080 public:
00081     CzResourceGroupCreator()
00082     {
00083         setClassName("resourcegroup");
00084     }
00085     IzXomlResource* CreateInstance(IzXomlResource* parent);
00086 };*/
00087 
00088 /**
00089  @class CzGlobalResources
00090 
00091  @brief Manages application global resources.
00092 
00093  Represents a collection of resources that are meant to be accessible across the entire game / app and for the life time of the game / app. A CzGlobalResources contains a number of manager sthat 
00094  enable it to manage a number of different types of resources include:
00095  - CzXomlVariableManage - Manages XOML variables
00096  - CzActionsManager - Manages actions
00097  - CzAnimTimelinesManager - Manages timelines
00098  - CzTimersManager - Manages timers
00099  - CzProgramManager - Manages a collection of XOML programs
00100  - CzXomlResourceManager - Manages all other types of resources
00101 
00102  The CzGlobalResources class is a singleton that is available via the CZ_GLOBAL_RESOURCES macros.
00103 
00104  */
00105 
00106 class CzGlobalResources
00107 {
00108     CDEFINE_SINGLETON(CzGlobalResources)
00109 
00110 protected:
00111     // Properties
00112     CzXomlResourceManager*      ResourceManager;        ///< Manages all types of resources
00113     CzXomlVariableManager*      VariableManager;        ///< Manages XOML variables
00114     CzActionsManager*           ActionsManager;         ///< Manages actions
00115     CzAnimTimelinesManager*     TimelinesManager;       ///< Manages timelines
00116     CzTimersManager*            TimersManager;          ///< Manages timers
00117     CzProgramManager*           ProgramManager;         ///< Manages a collection of XOML programs
00118     IzScriptEngine*             ScriptEngine;           ///< manages a script
00119 public:
00120     CzXomlResourceManager*      getResourceManager()                { return ResourceManager; }
00121     CzXomlVariableManager*      getVariableManager()                { return VariableManager; }
00122     CzActionsManager*           getActionsManager()                 { return ActionsManager; }
00123     CzAnimTimelinesManager*     getTimelinesManager()               { return TimelinesManager; }
00124     CzTimersManager*            getTimersManager()                  { return TimersManager; }
00125     CzProgramManager*           getProgramManager()                 { return ProgramManager; }
00126     IzScriptEngine*             getScriptEngine(CzScript::eScriptType type = CzScript::ST_None);        ///< Returns the script engine that is being used by the global resources manager
00127     // Properties end
00128 
00129 public:
00130     void                        Init(IzXomlResource* parent);       ///< Initialises the global resources system
00131     void                        Release();                          ///< Releases the global resources system, releasing all global resources
00132     void                        Update(float dt);                   ///< Update the resource manager
00133 };
00134 
00135 /**
00136  @def   CZ_GLOBAL_RESOURCES
00137 
00138  @brief A macro that returns the global resources singleton.
00139  */
00140 #define CZ_GLOBAL_RESOURCES             CzGlobalResources::getInstance()
00141 
00142 /**
00143  @def   CZ_GLOBAL_RESOURCE_MANAGER
00144 
00145  @brief A macro that returns the global resource manager.
00146  */
00147 #define CZ_GLOBAL_RESOURCE_MANAGER      CZ_GLOBAL_RESOURCES->getResourceManager()
00148 
00149 /**
00150  @def   CZ_GLOBAL_VARIABLE_MANAGER
00151 
00152  @brief A macro that returns the global XOML variables manager.
00153  */
00154 #define CZ_GLOBAL_VARIABLE_MANAGER      CZ_GLOBAL_RESOURCES->getVariableManager()
00155 
00156 /**
00157  @def   CZ_GLOBAL_ACTIONS_MANAGER
00158 
00159  @brief A macro that returns the global actions manager.
00160  */
00161 #define CZ_GLOBAL_ACTIONS_MANAGER       CZ_GLOBAL_RESOURCES->getActionsManager()
00162 
00163 /**
00164  @def   CZ_GLOBAL_TIMELINE_MANAGER
00165 
00166  @brief A macro that returns the global timelines manager.
00167  */
00168 #define CZ_GLOBAL_TIMELINE_MANAGER      CZ_GLOBAL_RESOURCES->getTimelinesManager()
00169 
00170 /**
00171  @def   CZ_GLOBAL_TIMERS_MANAGER
00172 
00173  @brief A macro that returns the global timers manager.
00174  */
00175 #define CZ_GLOBAL_TIMERS_MANAGER        CZ_GLOBAL_RESOURCES->getTimersManager()
00176 
00177 /**
00178  @def   CZ_GLOBAL_PROGRAM_MANAGER
00179 
00180  @brief A macro that returns the global XOML programs manager.
00181  */
00182 #define CZ_GLOBAL_PROGRAM_MANAGER       CZ_GLOBAL_RESOURCES->getProgramManager()
00183 
00184 /// @}
00185 
00186 #endif  // _CZ_RESOURCES_H_