Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/tutorialFS09/src/core/input/ExtendedInputState.h @ 10108

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

FIRST THINGS FIRST: Delete or rename your keybindings.ini (def_keybindings.ini already has the most important bindings) or else you won't be able to do anything!

Changes:

  • Multiple joy stick support should now fully work with KeyBinder too (only tested with 0/1 joystick)
  • Reloading the OIS Devices now works with KeyBinder too
  • Modified ConfigValueContainer to accept arbitrary section names
  • added tkeybind to temporary bind a command to a key
  • Fixed dlleport issue in ArgumentCompletionFunctions.h

Internal changes:

  • General cleanup in initialisation of KeyBinder
  • All names of keys/buttons/axes are now statically saved in InputInterfaces.h
  • Move a magic value in KeyBinder to a configValue (MouseWheelStepSize_)
  • Separated ConfigValues from Keybinding ConfigValueContainer in KeyBinder (looks much nicer now ;))
  • Moved some performance critical small function to the inline section
  • Removed the ugly keybind function construct from the InputManager
  • More 'harmonising' work in KeyBinder
  • Property svn:eol-style set to native
File size: 3.3 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 _ExtendedInputState_H__
35#define _ExtendedInputState_H__
36
37#include "core/CorePrereqs.h"
38
39#include <vector>
40
41#include "InputInterfaces.h"
42#include "InputState.h"
43
44namespace orxonox
45{
46
47    class _CoreExport ExtendedInputState : public InputState
48    {
49        friend class InputManager;
50
51    public:
52        bool addKeyHandler        (KeyHandler* handler);
53        bool removeKeyHandler     (KeyHandler* handler);
54
55        bool addMouseHandler      (MouseHandler* handler);
56        bool removeMouseHandler   (MouseHandler* handler);
57
58        bool addJoyStickHandler   (JoyStickHandler* handler, unsigned int joyStickID);
59        bool removeJoyStickHandler(JoyStickHandler* handler, unsigned int joyStickID);
60        bool addJoyStickHandler   (JoyStickHandler* handler);
61        bool removeJoyStickHandler(JoyStickHandler* handler);
62
63        bool addHandler(InputHandler* handler);
64        bool removeHandler(InputHandler* handler);
65
66    private:
67        ExtendedInputState() { }
68        ~ExtendedInputState() { }
69
70        void tickInput(float dt);
71        void tickInput(float dt, unsigned int device);
72
73        void keyPressed (const KeyEvent& evt);
74        void keyReleased(const KeyEvent& evt);
75        void keyHeld    (const KeyEvent& evt);
76
77        void mouseButtonPressed (MouseButtonCode::ByEnum id);
78        void mouseButtonReleased(MouseButtonCode::ByEnum id);
79        void mouseButtonHeld    (MouseButtonCode::ByEnum id);
80        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
81        void mouseScrolled      (int abs, int rel);
82
83        void joyStickButtonPressed (unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
84        void joyStickButtonReleased(unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
85        void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
86        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);        void updateTickables();
87
88        void numberOfJoySticksChanged(unsigned int n);
89        void update();
90
91        std::vector<KeyHandler*>                    keyHandlers_;
92        std::vector<MouseHandler*>                  mouseHandlers_;
93        std::vector<std::vector<JoyStickHandler*> > joyStickHandlers_;
94        std::vector<JoyStickHandler*>               joyStickHandlersAll_;
95
96        std::vector<InputHandler*> allHandlers_;
97    };
98}
99
100#endif /* _ExtendedInputState_H__ */
Note: See TracBrowser for help on using the repository browser.