source: OGRE/trunk/ogrenew/PlatformManagers/gtk/include/GTKInput.h @ 692

Revision 692, 2.9 KB checked in by mattausch, 19 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://ogre.sourceforge.net/
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 INCL_GTKINPUT_H
27#define INCL_GTKINPUT_H
28
29#include "OgreInput.h"
30
31#include <gdk/gdkevents.h>
32#include <gtkmm/window.h>
33#include <gtkmm/main.h>
34#include <gtkmm/gl/drawingarea.h>
35
36#include <sigc++/object.h>
37
38namespace Ogre {
39
40class GTKInput : public InputReader, public SigC::Object
41{
42public:
43    GTKInput();
44    virtual ~GTKInput();
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
65protected:
66    bool on_mouse_motion(GdkEventMotion* event);
67    bool on_key_press(GdkEventKey* event);
68    bool on_key_release(GdkEventKey* event);
69    bool on_button_press(GdkEventButton* event);
70    bool on_button_release(GdkEventButton* event);
71    bool isKeyDownImmediate( KeyCode kc ) const;
72
73private:
74    // Capture mouse?
75    bool mUseMouse;
76    int mMouseX, mMouseY;
77    int mMouseCenterX, mMouseCenterY;
78   
79    Real mScale;
80    unsigned int mMouseKeys;
81    bool _visible;
82    typedef std::map<guint, KeyCode> InputKeyMap;
83    InputKeyMap _key_map;
84    typedef std::map<KeyCode, guint> RInputKeyMap;
85    RInputKeyMap _rkey_map;
86    typedef std::set<guint> CurKeySet;
87    CurKeySet _cur_keys;
88    CurKeySet _captured_keys;
89    //GTKWindow* _win;
90    Gtk::Window *_win;
91    Gtk::GL::DrawingArea * _widget;
92    Gtk::Main *_kit;
93}; // class GTKInput
94
95}; // namespace Ogre
96
97#endif // INCL_GTKINPUT_H
Note: See TracBrowser for help on using the repository browser.