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

Revision 692, 2.7 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

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        CARD32 mHiddenCursor;
67
68        // Map of X keys -> Ogre keys
69        typedef std::map<KeySym, KeyCode> InputKeyMap;
70        InputKeyMap _key_map;
71
72        // Map of currently pressed keys
73        typedef std::set<KeyCode> KeyPressedSet;
74        KeyPressedSet _key_pressed_set;
75
76        // Does the ogre input system want to capture the mouse (set with useMouse flag
77        // on initialise)
78        bool captureMouse;
79        // Is mouse currently warped (captured within window?)
80        bool warpMouse;
81        int mouseLastX, mouseLastY;
82
83        // Display and window, for event pumping
84        Display *mDisplay;
85        Window mWindow;
86        RenderWindow *mRenderWindow;
87
88        static const unsigned int mWheelStep = 100;
89
90        void GrabCursor(bool grab);
91
92    bool isKeyDownImmediate( KeyCode kc ) const;
93};
94
95}; // Namespace
96
97#endif
98
Note: See TracBrowser for help on using the repository browser.