Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/InputHandler.h @ 1118

Last change on this file since 1118 was 1062, checked in by rgrieder, 17 years ago
  • changed header file inclusion order
File size: 3.2 KB
RevLine 
[971]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
[1056]3 *                    > www.orxonox.net <
[971]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 */
[973]28
[971]29/**
30 @file
[1022]31 @brief Different definitions of input processing.
[971]32 */
[973]33
34#ifndef _InputHandler_H__
35#define _InputHandler_H__
36
[1062]37#include "CorePrereqs.h"
38
[1022]39#include <string>
[973]40#include <OIS/OIS.h>
41
[1022]42#include "InputEvent.h"
[973]43
44namespace orxonox
45{
46  /**
[1022]47    @brief Captures mouse and keyboard input while in the actual game mode.
48    Manages the key bindings.
[973]49  */
[1022]50  class _CoreExport InputHandlerGame
[973]51        : public OIS::KeyListener, public OIS::MouseListener
52  {
53  public:
[1022]54    InputHandlerGame ();
55    ~InputHandlerGame();
[973]56
[1022]57    bool loadBindings();
58
[973]59  private:
60    // input events
61                bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
62                bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
63    bool mouseMoved   (const OIS::MouseEvent &arg);
64                bool keyPressed   (const OIS::KeyEvent   &arg);
65                bool keyReleased  (const OIS::KeyEvent   &arg);
[1022]66
67    // temporary hack
68    void callListeners(InputEvent &evt);
69
70    /** denotes the maximum number of different keys there are in OIS.
71        256 should be ok since the highest number in the enum is 237. */
72    static const int numberOfKeys_s = 256;
73    //! Array of input events for every pressed key
74    std::string bindingsKeyPressed_[numberOfKeys_s];
75    //! Array of input events for every released key
76    std::string bindingsKeyReleased_[numberOfKeys_s];
77
78    /** denotes the maximum number of different buttons there are in OIS.
79        16 should be ok since the highest number in the enum is 7. */
80    static const int numberOfButtons_s = 16;
81    //! Array of input events for every pressed key
82    std::string bindingsButtonPressed_[numberOfButtons_s];
83    //! Array of input events for every released key
84    std::string bindingsButtonReleased_[numberOfButtons_s];
85
[973]86  };
87
88
89  /**
[1022]90    @brief Captures mouse and keyboard input and distributes it to the
91    GUI.
[973]92  */
[1022]93  class _CoreExport InputHandlerGUI
[973]94        : public OIS::KeyListener, public OIS::MouseListener
95  {
96  public:
[1022]97    InputHandlerGUI ();
98    ~InputHandlerGUI();
[973]99
100  private:
101    // input events
102                bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
103                bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
104    bool mouseMoved   (const OIS::MouseEvent &arg);
105                bool keyPressed   (const OIS::KeyEvent   &arg);
106                bool keyReleased  (const OIS::KeyEvent   &arg);
107  };
108
109}
110
111#endif /* _InputHandler_H__ */
Note: See TracBrowser for help on using the repository browser.