Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/orxonox/InputHandler.h @ 919

Last change on this file since 919 was 919, checked in by rgrieder, 17 years ago
  • AudioManager is now Tickable
  • NPC update moved to its tick-function
  • corrected CMakeLists
  • added a few window properties to GraphicsEngine
  • OrxListener has been completely replaced
File size: 2.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Reto Grieder
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28/**
29 @file
30 @brief Implementation of a little Input handler that distributes everything
31        coming from OIS.
32 */
33
34#ifndef _InputHandler_H__
35#define _InputHandler_H__
36
37#include <OIS/OISPrereqs.h>
38#include <OIS/OISMouse.h>
39#include <OIS/OISKeyboard.h>
40
41#include "OrxonoxPrereqs.h"
42//#include "core/OrxonoxClass.h"
43#include "core/Tickable.h"
44
45namespace orxonox
46{
47  class _OrxonoxExport InputHandler
48        : public Tickable,
49          public OIS::KeyListener, public OIS::MouseListener
50  {
51  public:
52
53    void initialise(size_t windowHnd, int windowWidth, int windowHeight);
54    void tick(float dt);
55    void setWindowExtents(int width, int height);
56
57    OIS::Mouse    *getMouse()    { return this->mouse_   ; }
58    OIS::Keyboard *getKeyboard() { return this->keyboard_; }
59
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);
66
67    static InputHandler* getSingleton();
68
69    void setConfigValues();
70
71  private:
72    // don't mess with a Singleton
73    InputHandler ();
74    InputHandler (const InputHandler&) { }
75    ~InputHandler() { }
76
77    OIS::InputManager *inputSystem_;
78    OIS::Keyboard     *keyboard_;
79    OIS::Mouse        *mouse_;
80
81    // Key bindings
82    int codeFire_;
83    OIS::KeyCode codeMoveForward_;
84
85  };
86}
87
88#endif /* _InputHandler_H__ */
Note: See TracBrowser for help on using the repository browser.