4
Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
6
This program is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version.
11
This program is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
You should have received a copy of the GNU General Public License along
17
with this program; if not, write to the Free Software Foundation, Inc.,
18
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
contact: plee-the-bear@gamned.org
22
Please add the tag [Bear] in the subject of your mails.
25
* \file controller_button.cpp
26
* \brief Informations on a pressed key.
27
* \author Julien Jorge
29
#include "input/controller_button.hpp"
31
/*----------------------------------------------------------------------------*/
35
bear::input::controller_button::controller_button()
36
: m_type(controller_not_set)
39
} // controller_button::controller_button()
41
/*----------------------------------------------------------------------------*/
44
* \param key The keyboard key to store.
46
bear::input::controller_button::controller_button( const key_info& key )
47
: m_type(controller_keyboard), m_keyboard(key)
50
} // controller_button::controller_button()
52
/*----------------------------------------------------------------------------*/
55
* \param joy The joystick button to store.
57
bear::input::controller_button::controller_button( const joystick_button& joy )
58
: m_type(controller_joystick), m_joystick(joy)
61
} // controller_button::controller_button()
63
/*----------------------------------------------------------------------------*/
66
* \param m The mouse button to store.
68
bear::input::controller_button::controller_button( mouse::mouse_code m )
69
: m_type(controller_mouse), m_mouse(m)
72
} // controller_button::controller_button()
74
/*----------------------------------------------------------------------------*/
76
* \brief Assignment operator.
77
* \param key The keyboard key to store.
79
bear::input::controller_button&
80
bear::input::controller_button::operator=( const key_info& key )
82
m_type = controller_keyboard;
85
} // controller_button::operator=()
87
/*----------------------------------------------------------------------------*/
89
* \brief Assignement operator.
90
* \param joy The joystick button to store.
92
bear::input::controller_button&
93
bear::input::controller_button::operator=( const joystick_button& joy )
95
m_type = controller_joystick;
98
} // controller_button::operator=()
100
/*----------------------------------------------------------------------------*/
102
* \brief Assignment operator.
103
* \param m The mouse button to store.
105
bear::input::controller_button&
106
bear::input::controller_button::operator=( mouse::mouse_code m )
108
m_type = controller_mouse;
111
} // controller_button::operator=()
113
/*----------------------------------------------------------------------------*/
115
* \brief Get the type of the controller for which the button is stored.
117
bear::input::controller_button::controller_type
118
bear::input::controller_button::get_type() const
121
} // controller_button::get_type()
123
/*----------------------------------------------------------------------------*/
125
* \brief Get the keyboard button.
127
const bear::input::key_info&
128
bear::input::controller_button::get_key_info() const
130
CLAW_PRECOND( m_type == controller_keyboard );
132
} // controller_button::get_key_info()
134
/*----------------------------------------------------------------------------*/
136
* \brief Get the joystick button.
138
const bear::input::joystick_button&
139
bear::input::controller_button::get_joystick_button() const
141
CLAW_PRECOND( m_type == controller_joystick );
143
} // controller_button::get_joystick_button()
145
/*----------------------------------------------------------------------------*/
147
* \brief Get the mouse button.
149
bear::input::mouse::mouse_code
150
bear::input::controller_button::get_mouse_code() const
152
CLAW_PRECOND( m_type == controller_mouse );
154
} // controller_button::get_mouse_code()