Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gui/src/core/input/SimpleInputState.h @ 1638

Last change on this file since 1638 was 1638, checked in by rgrieder, 16 years ago

merged input branch into gui test branch (was about time)
svn save (it's still a mess and CMLs haven't been updated)
I'll have to create a special project to create the tolua_bind files for tolua itself anyway..

  • Property svn:eol-style set to native
File size: 3.0 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/**
30@file
31@brief
32*/
33
34#ifndef _SimpleInputState_H__
35#define _SimpleInputState_H__
36
37#include "core/CorePrereqs.h"
38
39#include <vector>
40#include "InputInterfaces.h"
41#include "InputState.h"
42
43namespace orxonox
44{
45
46    class _CoreExport SimpleInputState : public InputState
47    {
48
49    public:
50        SimpleInputState();
51        ~SimpleInputState() { }
52
53        void setKeyHandler        (KeyHandler* handler) { keyHandler_ = handler; update(); }
54        void setMouseHandler      (MouseHandler* handler) { mouseHandler_ = handler; update(); }
55        bool setJoyStickHandler   (JoyStickHandler* handler, unsigned int joyStickID);
56        bool setJoyStickHandler   (JoyStickHandler* handler);
57        bool setHandler(InputTickable* handler);
58        void removeAndDestroyAllHandlers();
59
60    private:
61        void tickInput(float dt);
62        void tickInput(float dt, unsigned int device);
63
64        void keyPressed (const KeyEvent& evt);
65        void keyReleased(const KeyEvent& evt);
66        void keyHeld    (const KeyEvent& evt);
67
68        void mouseButtonPressed (MouseButton::Enum id);
69        void mouseButtonReleased(MouseButton::Enum id);
70        void mouseButtonHeld    (MouseButton::Enum id);
71        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
72        void mouseScrolled      (int abs, int rel);
73
74        void joyStickButtonPressed (unsigned int joyStickID, unsigned int button);
75        void joyStickButtonReleased(unsigned int joyStickID, unsigned int button);
76        void joyStickButtonHeld    (unsigned int joyStickID, unsigned int button);
77        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);
78
79        void update();
80        void numberOfJoySticksChanged(unsigned int n);
81
82        KeyHandler*                   keyHandler_;
83        MouseHandler*                 mouseHandler_;
84        std::vector<JoyStickHandler*> joyStickHandler_;
85        JoyStickHandler*              joyStickHandlerAll_;
86        std::vector<InputTickable*>   allHandlers_;
87    };
88}
89
90#endif /* _SimpleInputState_H__ */
Note: See TracBrowser for help on using the repository browser.