Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / control / controller.cpp
index e7fe383..b936ee8 100644 (file)
@@ -1,28 +1,20 @@
-//  $Id$
-// 
 //  SuperTux
-//  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//  Copyright (C) 2006 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
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
 //
 //  This program is distributed in the hope that it will be useful,
 //  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
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-//  02111-1307, USA.
-
-#include <config.h>
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include "controller.hpp"
-
-extern Controller* main_controller;
+#include "control/controller.hpp"
 
 const char* Controller::controlNames[] = {
   "left",
@@ -34,6 +26,10 @@ const char* Controller::controlNames[] = {
   "pause-menu",
   "menu-select",
   "console",
+  "peek-left",
+  "peek-right",
+  "peek-up",
+  "peek-down",
   0
 };
 
@@ -63,13 +59,13 @@ Controller::hold(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] == true && controls[control] == false;
+  return oldControls[control] && !controls[control];
 }
 
 void
@@ -78,3 +74,5 @@ Controller::update()
   for(int i = 0; i < CONTROLCOUNT; ++i)
     oldControls[i] = controls[i];
 }
+
+/* EOF */