source: OGRE/trunk/ogrenew/OgreMain/include/OgreCursor.h @ 657

Revision 657, 4.6 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25
26
27/***************************************************************************
28OgreCursor.h  - 
29        The Cursor is an non-visual object that contains a the XYZ values that
30        are modified by a InputReader.
31        An InputReader creates and contains a Cursor object that it uses when it
32        is set to buffered input (using the EventQueue).
33
34        To get a graphical representation of the cursor, a CursorGuiElement is
35        used, which is a MouseMotionListener to the Cursor.
36
37-------------------
38begin                : Nov 19 2002
39copyright            : (C) 2002 by Kenny Sabir
40email                : kenny@sparksuit.com
41***************************************************************************/
42
43#ifndef __Cursor_H__
44#define __Cursor_H__
45
46#include "OgrePrerequisites.h"
47#include "OgreMouseMotionTarget.h"
48#include "OgreMouseTarget.h"
49
50namespace Ogre {
51        /** The Cursor is an non-visual object that contains a the XYZ values that
52                are modified by a InputReader.
53        @remarks
54                An InputReader creates and contains a Cursor object that it uses when it
55                is set to buffered input (using the EventQueue).
56
57                To get a graphical representation of the cursor, a CursorGuiElement is
58                used, which is a MouseMotionListener to the Cursor.
59        */
60        class _OgreExport Cursor : public MouseMotionTarget, public MouseTarget
61    {
62    protected:
63                /** Cursor position */
64        Real mMouseX, mMouseY, mMouseZ;
65
66        /** relative cursor position */
67        Real mRelX, mRelY, mRelZ;
68
69                /** Cursor limits 0-1 */
70                Real mXLowLimit, mXHighLimit, mYLowLimit, mYHighLimit, mZLowLimit, mZHighLimit;
71
72                /** Scale the cursor movements. Initially set at 1 (no scaling).
73                        The scaling effects all axis, XYZ */
74                Real mScale;
75
76                /** inline function to clip a value to its low and high limits */
77                inline Real limit(Real val, Real low, Real high)
78                {       return (val < low) ? low: ((val > high) ? high : val); }
79        public :
80                Cursor();
81                virtual ~Cursor();
82
83                /** add relative amount to X */
84                void addToX(Real val);
85
86                /** add relative amount to Y */
87                void addToY(Real val);
88
89                /** add relative amount to Z */
90                void addToZ(Real val);
91
92                /** process the mouse events that are for any listeners to the cursor */
93                void processEvent(InputEvent* e);
94
95
96                /** get the current X position of the cursor 0 left, 1 right */
97                Real getX() const;
98
99                /** get the current Y position of the cursor 0 top, 1 bottom */
100                Real getY() const;
101
102                /** get the current Z position of the cursor 0 none, 1 full */
103                Real getZ() const;
104
105        /** get relative X cursor movement */
106        Real getRelX() const {return mRelX;}
107
108        /** get relative Y cursor movement */
109        Real getRelY() const {return mRelY;}
110
111        /** get relative Z cursor movement */
112        Real getRelZ() const {return mRelZ;}
113
114
115
116        // PositionTarget methods
117        /** Gets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
118        Real getLeft(void) const ;
119
120        /** Gets the top of this element in relation to the screen (where 0 = top, 1.0 = bottom)  */
121        Real getTop(void) const ;
122
123                /** The parent of the cursor is NULL as it's position is absolute in the window */
124                PositionTarget* getPositionTargetParent() const;
125
126                inline virtual bool isKeyEnabled() const
127                { return false; }
128
129                /** Gets the current cursor movement scaling factor. */
130                Real getScale(void) const { return mScale; }
131                /** Sets the current cursor movement scaling factor. */
132                void setScale(Real scale) { mScale = scale; }
133               
134
135    };
136
137}
138
139
140#endif  // __Cursor_H__
Note: See TracBrowser for help on using the repository browser.