~ubuntu-branches/ubuntu/trusty/plee-the-bear/trusty-proposed

« back to all changes in this revision

Viewing changes to bear-engine/core/src/input/code/controller_button.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Bear Engine
 
3
 
 
4
  Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
 
5
 
 
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.
 
10
 
 
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
 
14
  more details.
 
15
 
 
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
 
19
 
 
20
  contact: plee-the-bear@gamned.org
 
21
 
 
22
  Please add the tag [Bear] in the subject of your mails.
 
23
*/
 
24
/**
 
25
 * \file controller_button.cpp
 
26
 * \brief Informations on a pressed key.
 
27
 * \author Julien Jorge
 
28
 */
 
29
#include "input/controller_button.hpp"
 
30
 
 
31
/*----------------------------------------------------------------------------*/
 
32
/**
 
33
 * \brief Constructor.
 
34
 */
 
35
bear::input::controller_button::controller_button()
 
36
  : m_type(controller_not_set)
 
37
{
 
38
 
 
39
} // controller_button::controller_button()
 
40
 
 
41
/*----------------------------------------------------------------------------*/
 
42
/**
 
43
 * \brief Constructor.
 
44
 * \param key The keyboard key to store.
 
45
 */
 
46
bear::input::controller_button::controller_button( const key_info& key )
 
47
  : m_type(controller_keyboard), m_keyboard(key)
 
48
{
 
49
 
 
50
} // controller_button::controller_button()
 
51
 
 
52
/*----------------------------------------------------------------------------*/
 
53
/**
 
54
 * \brief Constructor.
 
55
 * \param joy The joystick button to store.
 
56
 */
 
57
bear::input::controller_button::controller_button( const joystick_button& joy )
 
58
  : m_type(controller_joystick), m_joystick(joy)
 
59
{
 
60
 
 
61
} // controller_button::controller_button()
 
62
 
 
63
/*----------------------------------------------------------------------------*/
 
64
/**
 
65
 * \brief Constructor.
 
66
 * \param m The mouse button to store.
 
67
 */
 
68
bear::input::controller_button::controller_button( mouse::mouse_code m )
 
69
  : m_type(controller_mouse), m_mouse(m)
 
70
{
 
71
 
 
72
} // controller_button::controller_button()
 
73
 
 
74
/*----------------------------------------------------------------------------*/
 
75
/**
 
76
 * \brief Assignment operator.
 
77
 * \param key The keyboard key to store.
 
78
 */
 
79
bear::input::controller_button&
 
80
bear::input::controller_button::operator=( const key_info& key )
 
81
{
 
82
  m_type = controller_keyboard;
 
83
  m_keyboard = key;
 
84
  return *this;
 
85
} // controller_button::operator=()
 
86
 
 
87
/*----------------------------------------------------------------------------*/
 
88
/**
 
89
 * \brief Assignement operator.
 
90
 * \param joy The joystick button to store.
 
91
 */
 
92
bear::input::controller_button&
 
93
bear::input::controller_button::operator=( const joystick_button& joy )
 
94
{
 
95
  m_type = controller_joystick;
 
96
  m_joystick = joy;
 
97
  return *this;
 
98
} // controller_button::operator=()
 
99
 
 
100
/*----------------------------------------------------------------------------*/
 
101
/**
 
102
 * \brief Assignment operator.
 
103
 * \param m The mouse button to store.
 
104
 */
 
105
bear::input::controller_button&
 
106
bear::input::controller_button::operator=( mouse::mouse_code m )
 
107
{
 
108
  m_type = controller_mouse;
 
109
  m_mouse = m;
 
110
  return *this;
 
111
} // controller_button::operator=()
 
112
 
 
113
/*----------------------------------------------------------------------------*/
 
114
/**
 
115
 * \brief Get the type of the controller for which the button is stored.
 
116
 */
 
117
bear::input::controller_button::controller_type
 
118
bear::input::controller_button::get_type() const
 
119
{
 
120
  return m_type;
 
121
} // controller_button::get_type()
 
122
 
 
123
/*----------------------------------------------------------------------------*/
 
124
/**
 
125
 * \brief Get the keyboard button.
 
126
 */
 
127
const bear::input::key_info&
 
128
bear::input::controller_button::get_key_info() const
 
129
{
 
130
  CLAW_PRECOND( m_type == controller_keyboard );
 
131
  return m_keyboard;
 
132
} // controller_button::get_key_info()
 
133
 
 
134
/*----------------------------------------------------------------------------*/
 
135
/**
 
136
 * \brief Get the joystick button.
 
137
 */
 
138
const bear::input::joystick_button&
 
139
bear::input::controller_button::get_joystick_button() const
 
140
{
 
141
  CLAW_PRECOND( m_type == controller_joystick );
 
142
  return m_joystick;
 
143
} // controller_button::get_joystick_button()
 
144
 
 
145
/*----------------------------------------------------------------------------*/
 
146
/**
 
147
 * \brief Get the mouse button.
 
148
 */
 
149
bear::input::mouse::mouse_code
 
150
bear::input::controller_button::get_mouse_code() const
 
151
{
 
152
  CLAW_PRECOND( m_type == controller_mouse );
 
153
  return m_mouse;
 
154
} // controller_button::get_mouse_code()