# 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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029
    00030 #ifndef __Overlay_H__
    00031 #define __Overlay_H__
    00032
    00033 #include "OgrePrerequisites.h"
    00034 #include "OgreSceneNode.h"
    00035 #include "OgreIteratorWrappers.h"
    00036 #include "OgreMatrix4.h"
    00037
    00038 namespace Ogre {
    00039
    00040
    00065     class _OgreExport Overlay : public OverlayAlloc
    00066     {
    00067
    00068     public:
    00069               typedef std::list<OverlayContainer*> OverlayContainerList;
    00070     protected:
    00071         String mName;
    00073         SceneNode* mRootNode;
    00074         // 2D elements
    00075         // OverlayContainers, linked list for easy sorting by zorder later
    00076         // Not a map because sort can be saved since changes infrequent (unlike render queue)
    00077         OverlayContainerList m2DElements;
    00078
    00079         // Degrees of rotation around center
    00080         Radian mRotate;
    00081         // Scroll values, offsets
    00082         Real mScrollX, mScrollY;
    00083         // Scale values
    00084         Real mScaleX, mScaleY;
    00085
    00086         mutable Matrix4 mTransform;
    00087         mutable bool mTransformOutOfDate;
    00088         bool mTransformUpdated;
    00089         ulong mZOrder;
    00090         bool mVisible;
    00091         bool mInitialised;
    00092         String mOrigin;
    00094         void updateTransform(void) const;
    00096         void initialise(void);
    00098         void assignZOrders(void);
    00099
    00100     public:
    00102         Overlay(const String& name);
    00103         virtual ~Overlay();
    00104
    00105
    00106         OverlayContainer* getChild(const String& name);
    00107
    00109         const String& getName(void) const;
    00114         void setZOrder(ushort zorder);
    00116         ushort getZOrder(void) const;
    00117
    00119         bool isVisible(void) const;
    00120
    00122         bool isInitialised(void) const { return mInitialised; }
    00123
    00125         void show(void);
    00126
    00128         void hide(void);
    00129
    00140         void add2D(OverlayContainer* cont);
    00141
    00142
    00147         void remove2D(OverlayContainer* cont);
    00148
    00181         void add3D(SceneNode* node);
    00182
    00184         void remove3D(SceneNode* node);
    00185
    00187         void clear();
    00188
    00198         void setScroll(Real x, Real y);
    00199
    00201         Real getScrollX(void) const;
    00202
    00204         Real getScrollY(void) const;
    00205
    00212         void scroll(Real xoff, Real yoff);
    00213
    00215         void setRotate(const Radian& angle);
    00216
    00218         const Radian &getRotate(void) const { return mRotate; }
    00219
    00221         void rotate(const Radian& angle);
    00222
    00230         void setScale(Real x, Real y);
    00231
    00233         Real getScaleX(void) const;
    00234
    00236         Real getScaleY(void) const;
    00237
    00239         void _getWorldTransforms(Matrix4* xform) const;
    00240
    00242         void _findVisibleObjects(Camera* cam, RenderQueue* queue);
    00243
    00245         virtual OverlayElement* findElementAt(Real x, Real y);
    00246
    00251         typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ;
    00252         Overlay2DElementsIterator get2DElementsIterator ()
    00253         {
    00254             return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
    00255         }
    00262         const String& getOrigin(void) const { return mOrigin; }
    00264         void _notifyOrigin(const String& origin) { mOrigin = origin; }
    00265
    00266
    00267     };
    00268
    00269 }
    00270
    00271
    00272 #endif
    00273

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 14:26:43 2009