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 Different definitions of input processing. |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef _Button_H__ |
---|
35 | #define _Button_H__ |
---|
36 | |
---|
37 | #include "core/CorePrereqs.h" |
---|
38 | |
---|
39 | #include <string> |
---|
40 | #include <vector> |
---|
41 | |
---|
42 | namespace orxonox |
---|
43 | { |
---|
44 | class _CoreExport Button |
---|
45 | { |
---|
46 | public: |
---|
47 | Button() { nCommands_[0]=0; nCommands_[1]=0; nCommands_[2]=0; clear(); } |
---|
48 | virtual ~Button() { clear(); } |
---|
49 | virtual void clear(); |
---|
50 | virtual bool addParamCommand(ParamCommand* command) { return false; } |
---|
51 | void parse(std::vector<BufferedParamCommand*>& paramCommandBuffer); |
---|
52 | bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f); |
---|
53 | |
---|
54 | //! The configured string value |
---|
55 | std::string bindingString_; |
---|
56 | //! Name of the trigger as strings |
---|
57 | std::string name_; |
---|
58 | //! Basic commands for OnPress, OnHold and OnRelease |
---|
59 | BaseCommand** commands_[3]; |
---|
60 | //! Number of basic commands |
---|
61 | unsigned int nCommands_[3]; |
---|
62 | //! Says how much it takes for an analog axis to trigger a button |
---|
63 | //! Note: This variable is here to have only one parse() function. |
---|
64 | float buttonThreshold_; |
---|
65 | }; |
---|
66 | } |
---|
67 | |
---|
68 | #endif /* _Button_H__ */ |
---|