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

OgreOverlay.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 
00026 #ifndef __Overlay_H__
00027 #define __Overlay_H__
00028 
00029 #include "OgrePrerequisites.h"
00030 #include "OgreSceneNode.h"
00031 #include "OgreIteratorWrappers.h"
00032 #include "OgreMatrix4.h"
00033 #include "OgreResource.h"
00034 
00035 namespace Ogre {
00036 
00037 
00062     class _OgreExport Overlay : public Resource
00063     {
00064 
00065     public:
00066               typedef std::list<GuiContainer*> GuiContainerList;
00067     protected:
00068         ulong mZOrder;
00069         bool mVisible;
00071         SceneNode* mRootNode;
00072         // 2D elements
00073         // GuiContainers, linked list for easy sorting by zorder later
00074         // Not a map because sort can be saved since changes infrequent (unlike render queue)
00075         GuiContainerList m2DElements;
00076 
00077         // Degrees of rotation around center
00078         Radian mRotate;
00079         // Scroll values, offsets
00080         Real mScrollX, mScrollY;
00081         // Scale values
00082         Real mScaleX, mScaleY;
00083 
00084         mutable Matrix4 mTransform;
00085         mutable bool mTransformOutOfDate;
00086         bool mTransformUpdated;
00088         void updateTransform(void) const;
00089 
00090     public:
00092         Overlay(const String& name);
00093         virtual ~Overlay();
00094 
00096         virtual void load(void);
00098         virtual void unload(void);
00099 
00100         GuiContainer* getChild(const String& name);
00101 
00103         const String& getName(void) const;
00108         void setZOrder(ushort zorder);
00110         ushort getZOrder(void) const;
00111 
00113         bool isVisible(void) const;
00114 
00116         void show(void);
00117 
00119         void hide(void);
00120 
00131         void add2D(GuiContainer* cont);
00132 
00133 
00138         void remove2D(GuiContainer* cont);
00139 
00168         void add3D(SceneNode* node);
00169 
00171         void remove3D(SceneNode* node);
00172 
00174         void clear();
00175 
00185         void setScroll(Real x, Real y);
00186 
00188         Real getScrollX(void) const;
00189 
00191         Real getScrollY(void) const;
00192 
00199         void scroll(Real xoff, Real yoff);
00200 
00202         void setRotate(const Radian& angle);
00203 #ifndef OGRE_FORCE_ANGLE_TYPES
00204         inline void setRotate(Real degrees) {
00205             setRotate ( Angle(degrees) );
00206         }
00207 #endif//OGRE_FORCE_ANGLE_TYPES
00208 
00210         Radian getRotate(void) const { return mRotate; }
00211 
00213         void rotate(const Radian& angle);
00214 #ifndef OGRE_FORCE_ANGLE_TYPES
00215         inline void rotate(Real degrees) {
00216             rotate ( Angle(degrees) );
00217         }
00218 #endif//OGRE_FORCE_ANGLE_TYPES
00219 
00227         void setScale(Real x, Real y);
00228 
00230         Real getScaleX(void) const;
00231 
00233         Real getScaleY(void) const;
00234 
00236         void _getWorldTransforms(Matrix4* xform) const;
00238         const Quaternion& getWorldOrientation(void) const;
00240         const Vector3& getWorldPosition(void) const;
00241 
00243         void _findVisibleObjects(Camera* cam, RenderQueue* queue);
00244 
00246         virtual GuiElement* findElementAt(Real x, Real y);
00247 
00252         typedef VectorIterator<GuiContainerList> Overlay2DElementsIterator ;
00253         Overlay2DElementsIterator get2DElementsIterator ()
00254         {
00255             return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
00256         }
00257 
00258     };
00259 
00260 
00261 
00262 }
00263 
00264 
00265 #endif
00266 

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