SuperTuxKart
Loading...
Searching...
No Matches
binding.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2010-2015 Marianne Gagnon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19
20#ifndef BINDING_HPP
21#define BINDING_HPP
22
23
24#include "input/input.hpp"
25#include "utils/no_copy.hpp"
26
27#include "irrString.h"
28
29#include <fstream>
30
31class XMLNode;
32
36class Binding : public NoCopy
37{
38private:
39 Input::InputType m_type;
40 int m_id;
41 Input::AxisDirection m_dir;
42 Input::AxisRange m_range;
43public:
45 Input::InputType getType() const {return m_type; }
46 // ------------------------------------------------------------------------
48 int getId() const {return m_id;}
49 // ------------------------------------------------------------------------
51 Input::AxisDirection getDirection() const {return m_dir;}
52 // ------------------------------------------------------------------------
54 Input::AxisRange getRange() const {return m_range;}
55 // ------------------------------------------------------------------------
57 void set(Input::InputType type, int id,
58 Input::AxisDirection dir,
59 Input::AxisRange range)
60 {
61 m_type = type; m_id=id; m_dir=dir; m_range=range;
62 } // set
63
64 // ------------------------------------------------------------------------
65 void save(std::ofstream& stream) const;
66 bool load(const XMLNode *action);
67 irr::core::stringw getAsString() const;
68};
69#endif
Definition: binding.hpp:37
int getId() const
Returns the id this binding is using.
Definition: binding.hpp:48
irr::core::stringw getAsString() const
Returns a string representing this binding, which can be displayed on the screen.
Definition: binding.cpp:78
void save(std::ofstream &stream) const
Convert this binding to XML attributes.
Definition: binding.cpp:30
Input::AxisDirection getDirection() const
Returns the direction this binding is using.
Definition: binding.hpp:51
Input::InputType getType() const
Returns the type of device this binding is using.
Definition: binding.hpp:45
Input::AxisRange getRange() const
Returns the range this binding is using.
Definition: binding.hpp:54
void set(Input::InputType type, int id, Input::AxisDirection dir, Input::AxisRange range)
Defines all values of this binding.
Definition: binding.hpp:57
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
utility class used to parse XML files
Definition: xml_node.hpp:48