00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __OverlayManager_H__ 00026 #define __OverlayManager_H__ 00027 00028 #include <set> 00029 #include "OgrePrerequisites.h" 00030 #include "OgreEventDispatcher.h" 00031 #include "OgreEventListeners.h" 00032 #include "OgreEventTarget.h" 00033 #include "OgreResourceManager.h" 00034 #include "OgreSingleton.h" 00035 #include "OgreStringVector.h" 00036 #include "OgreEventDispatcher.h" 00037 #include "OgreTargetManager.h" 00038 00039 namespace Ogre { 00040 00044 class _OgreExport OverlayManager : public ResourceManager, public Singleton<OverlayManager>, public TargetManager, public EventTarget 00045 { 00046 protected: 00047 typedef std::list<MouseMotionListener*> MouseMotionListenerList; 00048 EventDispatcher mEventDispatcher; 00049 Overlay* mCursorLevelOverlay; 00050 bool mCursorGuiInitialised; 00051 GuiContainer* mCursorGuiRegistered; 00052 MouseMotionListener* mCursorListener; 00053 MouseMotionListenerList mMouseMotionListenerList; 00054 00055 void parseNewElement( DataChunk& chunk, String& elemType, String& elemName, 00056 bool isContainer, Overlay* pOverlay, bool isTemplate, String templateName = String(""), GuiContainer* container = 0); 00057 void parseAttrib( const String& line, Overlay* pOverlay); 00058 void parseElementAttrib( const String& line, Overlay* pOverlay, GuiElement* pElement ); 00059 void parseNewMesh(DataChunk& chunk, String& meshName, String& entityName, Overlay* pOverlay); 00060 void skipToNextCloseBrace(DataChunk& chunk); 00061 void skipToNextOpenBrace(DataChunk& chunk); 00062 00063 int mLastViewportWidth, mLastViewportHeight; 00064 bool mViewportDimensionsChanged; 00065 00066 StringVector mLoadedOverlays; 00067 // void dispatchEvent(InputEvent* e, 00068 00069 bool parseChildren( DataChunk& chunk, const String& line, 00070 Overlay* pOverlay, bool isTemplate, GuiContainer* parent = NULL); 00071 00072 public: 00073 OverlayManager(); 00074 virtual ~OverlayManager(); 00075 00077 void parseOverlayFile(DataChunk& chunk); 00079 void parseAllSources(const String& extension = ".overlay"); 00080 void parseOverlayFile(ArchiveEx* pArchiveEx, const String& name); 00081 00082 void loadAndParseOverlayFile(const String& filename); 00083 00085 virtual Resource* create( const String& name); 00086 00088 void _queueOverlaysForRendering(Camera* cam, RenderQueue* pQueue, Viewport *vp); 00089 00094 bool hasViewportChanged(void) const; 00095 00097 int getViewportHeight(void) const; 00098 00100 int getViewportWidth(void) const; 00101 00111 static OverlayManager& getSingleton(void); 00112 00113 00115 PositionTarget* getPositionTargetAt(Real x, Real y); 00116 00117 void processEvent(InputEvent* e); 00118 00120 void setDefaultCursorGui(GuiContainer* cursor, MouseMotionListener*); 00122 void setCursorGui(GuiContainer* cursor); 00123 void addMouseMotionListener(MouseMotionListener* l); 00124 void removeMouseMotionListener(MouseMotionListener* l); 00125 Real getMouseX() { return mEventDispatcher.getMouseX(); } 00126 Real getMouseY() { return mEventDispatcher.getMouseY(); } 00127 void setDragDrop(bool dragDropOn) { mEventDispatcher.setDragDrop(dragDropOn); } 00129 GuiContainer* getCursorGui(); 00130 00132 void createCursorOverlay(); 00133 }; 00134 00135 00136 00137 } 00138 00139 00140 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:20 2004