Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
00001 // Copyright (c) 2007-2008 Tomer Nosrati 00002 // This file is part of the "NUSoftware Game Engine". 00003 // For conditions of distribution and use, see copyright notice in nge.hpp 00004 00005 #pragma once 00006 #ifndef __I_GUI_CONTROLLER_H__ 00007 #define __I_GUI_CONTROLLER_H__ 00008 00009 #include "Irrlicht/irrlicht.h" 00010 00011 using namespace irr; 00012 using namespace irr::core; 00013 using namespace irr::gui; 00014 using namespace irr::scene; 00015 using namespace irr::video; 00016 00017 namespace nge 00018 { 00019 namespace gui 00020 { 00021 00022 template <class T> 00023 class IGUIController : public virtual irr::IReferenceCounted 00024 { 00025 public: 00026 IGUIController(ISceneManager* irrSmgr, IVideoDriver* irrDriver, IGUIEnvironment* irrEvn) 00027 : m_pSceneManager(irrSmgr), m_pVideoDriver(irrDriver), m_pGUIEnv(irrEvn), m_pElement(0), used(0) 00028 { 00029 } 00030 00032 virtual ~IGUIController() 00033 { 00034 // Clear(); 00035 } 00036 00037 virtual bool add(c8* file) = 0; 00038 00039 virtual void remove(u32 index) = 0; 00040 00041 virtual u32 size() const 00042 { 00043 return used; 00044 } 00045 00046 virtual T* get(u32 index) const 00047 { 00048 _NGE_DEBUG_BREAK_IF(index>used); // access violation 00049 00050 return m_aElements[index]; 00051 } 00052 00053 virtual T* getActive() const 00054 { 00055 return m_pElement; 00056 } 00057 00058 virtual void setActive(u32 index) 00059 { 00060 _NGE_DEBUG_BREAK_IF(index>used); // access violation 00061 00062 m_pElement = m_aElements[index]; 00063 } 00064 00065 virtual void Clear() 00066 { 00067 for(u32 i = 0; i < m_aElements.size(); ++i) 00068 { 00069 remove(i); 00070 } 00071 00072 m_aElements.clear(); 00073 } 00074 00075 protected: 00076 ISceneManager* m_pSceneManager; 00077 IVideoDriver* m_pVideoDriver; 00078 IGUIEnvironment* m_pGUIEnv; 00079 00080 array<T*> m_aElements; 00081 T* m_pElement; 00082 00083 u32 used; 00084 }; 00085 00086 } // namespace gui 00087 } // namespace nge 00088 00089 #endif // __I_GUI_CONTROLLER_H__
The NUSoftware Game Engine Documentation © 2007-2008 by Tomer Nosrati. Generated
on Sat Apr 26 16:52:34 2008 by Doxygen
(1.5.5) |