projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Comment out resizable flag because it blue-screens on Windows
[supertux.git]
/
src
/
control
/
controller.cpp
diff --git
a/src/control/controller.cpp
b/src/control/controller.cpp
index
b8eb8d5
..
11cfd65
100644
(file)
--- a/
src/control/controller.cpp
+++ b/
src/control/controller.cpp
@@
-1,7
+1,7
@@
// $Id$
// $Id$
-//
+//
// SuperTux
// SuperTux
-// Copyright (C) 200
5
Matthias Braun <matze@braunis.de>
+// Copyright (C) 200
6
Matthias Braun <matze@braunis.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@
-12,17
+12,14
@@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
#include <config.h>
-#include "controller.h"
-
-extern Controller* main_controller;
+#include "controller.hpp"
const char* Controller::controlNames[] = {
"left",
const char* Controller::controlNames[] = {
"left",
@@
-33,15
+30,17
@@
const char* Controller::controlNames[] = {
"action",
"pause-menu",
"menu-select",
"action",
"pause-menu",
"menu-select",
+ "console",
+ "peek-left",
+ "peek-right",
+ "peek-up",
+ "peek-down",
0
};
Controller::Controller()
{
0
};
Controller::Controller()
{
- for(int i = 0; i < CONTROLCOUNT; ++i) {
- controls[i] = false;
- oldControls[i] = false;
- }
+ reset();
}
Controller::~Controller()
}
Controller::~Controller()
@@
-65,7
+64,13
@@
Controller::hold(Control control)
bool
Controller::pressed(Control control)
{
bool
Controller::pressed(Control control)
{
- return oldControls[control] == false && controls[control] == true;
+ return !oldControls[control] && controls[control];
+}
+
+bool
+Controller::released(Control control)
+{
+ return oldControls[control] && !controls[control];
}
void
}
void