Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core4/src/core/input/Keyboard.h @ 3275

Last change on this file since 3275 was 3275, checked in by rgrieder, 15 years ago

Build fixes for actual compilers

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _Core_Keyboard_H__
30#define _Core_Keyboard_H__
31
32#include "InputPrereqs.h"
33#include "InputDevice.h"
34
35namespace orxonox
36{
37    /**
38    @brief
39        Wraps around an OIS::Mouse and forwards the input events to
40        a list of input states.
41
42        It also saves the state of the keyboard modifiers (like shift, etc.)
43    */
44    class _CoreExport Keyboard
45        : public InputDeviceTemplated<KeyboardTraits>
46        , public OIS::KeyListener
47    {
48        friend class InputDeviceTemplated<KeyboardTraits>;
49        //! Super class alias
50        typedef InputDeviceTemplated<KeyboardTraits> super;
51
52    public:
53        Keyboard(unsigned int id) : super(id), modifiers_(0) { }
54        ~Keyboard() { }
55
56    private:
57        // TODO: Do we need to reset the modifiers?
58        void clearBuffersImpl() { }
59        //! Translates the KeyHandle to a KeyEvent
60        KeyEvent& getButtonEventArg(KeyEvent& button) { button.setModifiers(modifiers_); return button; }
61
62        bool keyPressed(const OIS::KeyEvent& arg);
63        bool keyReleased(const OIS::KeyEvent& arg);
64
65        //! Bit mask representing keyboard modifiers
66        int modifiers_;
67    };
68}
69
70#endif /* _Core_Keyboard_H__ */
Note: See TracBrowser for help on using the repository browser.