Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# OgreOverlayManager.h

Go to the documentation of this file.

    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
    00068         bool parseChildren( DataChunk& chunk, const String& line,
    00069             Overlay* pOverlay, bool isTemplate, GuiContainer* parent = NULL);
    00070
    00071     public:
    00072         OverlayManager();
    00073         virtual ~OverlayManager();
    00074
    00076         void parseOverlayFile(DataChunk& chunk);
    00078         void parseAllSources(const String& extension = ".overlay");
    00079         void parseOverlayFile(ArchiveEx* pArchiveEx, const String& name);
    00080
    00081         void loadAndParseOverlayFile(const String& filename);
    00082
    00084         virtual Resource* create( const String& name);
    00085
    00087         void _queueOverlaysForRendering(Camera* cam, RenderQueue* pQueue, Viewport *vp);
    00088
    00093         bool hasViewportChanged(void) const;
    00094
    00096         int getViewportHeight(void) const;
    00097
    00099         int getViewportWidth(void) const;
    00100         Real getViewportAspectRatio(void) const;
    00101
    00103         PositionTarget* getPositionTargetAt(Real x, Real y);
    00104
    00105         void processEvent(InputEvent* e);
    00106
    00108         void setDefaultCursorGui(GuiContainer* cursor, MouseMotionListener*);
    00110         void setCursorGui(GuiContainer* cursor);
    00111         void addMouseMotionListener(MouseMotionListener* l);
    00112         void removeMouseMotionListener(MouseMotionListener* l);
    00113         Real getMouseX() { return mEventDispatcher.getMouseX(); }
    00114         Real getMouseY() { return mEventDispatcher.getMouseY(); }
    00115         void setDragDrop(bool dragDropOn) { mEventDispatcher.setDragDrop(dragDropOn); }
    00117         GuiContainer* getCursorGui();
    00118
    00120         void createCursorOverlay();
    00136         static OverlayManager& getSingleton(void);
    00152         static OverlayManager* getSingletonPtr(void);
    00153     };
    00154
    00155
    00156
    00157 }
    00158
    00159
    00160 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:37 2004