source: OGRE/trunk/ogrenew/PlatformManagers/GLX/include/OgreGLXInput.h @ 657

Revision 657, 2.8 KB checked in by mattausch, 18 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#ifndef __GLXInputReader_H__
27#define __GLXInputReader_H__
28
29#include "OgreInput.h"
30#include "OgreInputEvent.h"
31#include "OgreRenderWindow.h"
32
33#include <map>
34#include <set>
35
36#include <X11/Xlib.h>
37#include <X11/Xutil.h>
38#include <X11/keysym.h>
39#include <X11/Xproto.h>
40namespace Ogre {
41class GLXInput : public InputReader {
42public:
43        GLXInput();
44        virtual ~GLXInput();
45
46        void initialise( RenderWindow* pWindow, bool useKeyboard = true, bool useMouse = true, bool useGameController = false );
47        void capture();
48
49
50        /*
51         * Mouse getters
52         */
53        virtual long getMouseRelX() const;
54        virtual long getMouseRelY() const;
55        virtual long getMouseRelZ() const;
56
57        virtual long getMouseAbsX() const;
58        virtual long getMouseAbsY() const;
59        virtual long getMouseAbsZ() const;
60
61        virtual void getMouseState( MouseState& state ) const;
62
63        virtual bool getMouseButton( uchar button ) const;
64
65private:
66        float mMouseSpeed;      // Speed of mouse
67        CARD32 mHiddenCursor;
68
69        // Map of X keys -> Ogre keys
70        typedef std::map<KeySym, KeyCode> InputKeyMap;
71        InputKeyMap _key_map;
72
73        // Map of currently pressed keys
74        typedef std::set<KeyCode> KeyPressedSet;
75        KeyPressedSet _key_pressed_set;
76
77        // Does the ogre input system want to capture the mouse (set with useMouse flag
78        // on initialise)
79        bool captureMouse;
80        // Is mouse currently warped (captured within window?)
81        bool warpMouse;
82        int mouseLastX, mouseLastY;
83
84        // Display and window, for event pumping
85        Display *mDisplay;
86        Window mWindow;
87        RenderWindow *mRenderWindow;
88
89        static const unsigned int mWheelStep = 100;
90
91        void GrabCursor(bool grab);
92
93    bool isKeyDownImmediate( KeyCode kc ) const;
94};
95
96}; // Namespace
97
98#endif
99
Note: See TracBrowser for help on using the repository browser.