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

OgreCursor.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-2005 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 
00027 /***************************************************************************
00028 OgreCursor.h  -  
00029     The Cursor is an non-visual object that contains a the XYZ values that 
00030     are modified by a InputReader.
00031     An InputReader creates and contains a Cursor object that it uses when it 
00032     is set to buffered input (using the EventQueue).
00033 
00034     To get a graphical representation of the cursor, a CursorGuiElement is
00035     used, which is a MouseMotionListener to the Cursor.
00036 
00037 -------------------
00038 begin                : Nov 19 2002
00039 copyright            : (C) 2002 by Kenny Sabir
00040 email                : kenny@sparksuit.com
00041 ***************************************************************************/
00042 
00043 #ifndef __Cursor_H__
00044 #define __Cursor_H__
00045 
00046 #include "OgrePrerequisites.h"
00047 #include "OgreMouseMotionTarget.h"
00048 #include "OgreMouseTarget.h"
00049 
00050 namespace Ogre {
00060     class _OgreExport Cursor : public MouseMotionTarget, public MouseTarget
00061     {
00062     protected:
00064         Real mMouseX, mMouseY, mMouseZ;
00065 
00067         Real mRelX, mRelY, mRelZ;
00068 
00070         Real mXLowLimit, mXHighLimit, mYLowLimit, mYHighLimit, mZLowLimit, mZHighLimit;
00071 
00074         Real mScale;
00075 
00077         inline Real limit(Real val, Real low, Real high)
00078         {   return (val < low) ? low: ((val > high) ? high : val); }
00079     public :
00080         Cursor();
00081         virtual ~Cursor();
00082 
00084         void addToX(Real val);
00085 
00087         void addToY(Real val);
00088 
00090         void addToZ(Real val);
00091 
00093         void processEvent(InputEvent* e);
00094 
00095 
00097         Real getX() const;
00098 
00100         Real getY() const;
00101 
00103         Real getZ() const;
00104 
00106         Real getRelX() const {return mRelX;}
00107 
00109         Real getRelY() const {return mRelY;}
00110 
00112         Real getRelZ() const {return mRelZ;}
00113 
00114 
00115 
00116     // PositionTarget methods
00118         Real getLeft(void) const ;
00119 
00121         Real getTop(void) const ;
00122 
00124         PositionTarget* getPositionTargetParent() const;
00125 
00126         inline virtual bool isKeyEnabled() const
00127         { return false; }
00128 
00130         Real getScale(void) const { return mScale; }
00132         void setScale(Real scale) { mScale = scale; }
00133         
00134 
00135     };
00136 
00137 }
00138 
00139 
00140 #endif  // __Cursor_H__

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:39 2006