// $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
// 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.
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include <config.h>
#include <sstream>
#include "joystickkeyboardcontroller.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "gui/menu.hpp"
#include "gettext.hpp"
#include "lisp/lisp.hpp"
SDL_Joystick* joystick = SDL_JoystickOpen(i);
bool good = true;
if(SDL_JoystickNumButtons(joystick) < 2) {
- msg_warning << "Joystick " << i << " has less than 2 buttons" << std::endl;
+ log_warning << "Joystick " << i << " has less than 2 buttons" << std::endl;
good = false;
}
if(SDL_JoystickNumAxes(joystick) < 2
&& SDL_JoystickNumHats(joystick) == 0) {
- msg_warning << "Joystick " << i << " has less than 2 axes and no hat" << std::endl;
+ log_warning << "Joystick " << i << " has less than 2 axes and no hat" << std::endl;
good = false;
}
if(!good) {
map->get("key", key);
map->get("control", control);
if(key < SDLK_FIRST || key >= SDLK_LAST) {
- msg_warning << "Invalid key '" << key << "' in keymap" << std::endl;
+ log_warning << "Invalid key '" << key << "' in keymap" << std::endl;
continue;
}
break;
}
if(controlNames[i] == 0) {
- msg_warning << "Invalid control '" << control << "' in keymap" << std::endl;
+ log_warning << "Invalid control '" << control << "' in keymap" << std::endl;
continue;
}
keymap.insert(std::make_pair((SDLKey) key, (Control) i));
} else {
- msg_warning << "Invalid lisp element '" << iter.item() << "' in keymap" << std::endl;
+ log_warning << "Invalid lisp element '" << iter.item() << "' in keymap" << std::endl;
}
}
}
map->get("button", button);
map->get("control", control);
if(button < 0 || button >= max_joybuttons) {
- msg_warning << "Invalid button '" << button << "' in buttonmap" << std::endl;
+ log_warning << "Invalid button '" << button << "' in buttonmap" << std::endl;
continue;
}
break;
}
if(controlNames[i] == 0) {
- msg_warning << "Invalid control '" << control << "' in buttonmap" << std::endl;
+ log_warning << "Invalid control '" << control << "' in buttonmap" << std::endl;
continue;
}
reset_joybutton(button, (Control) i);
ButtonMap::iterator i = joy_button_map.find(event.jbutton.button);
if(i == joy_button_map.end()) {
- msg_debug << "Unmapped joybutton " << (int)event.jbutton.button << " pressed" << std::endl;
+ log_debug << "Unmapped joybutton " << (int)event.jbutton.button << " pressed" << std::endl;
return;
}
// if console key was pressed: toggle console
if ((key_mapping != keymap.end()) && (key_mapping->second == CONSOLE)) {
if (event.type != SDL_KEYDOWN) return;
- Console::toggle();
+ Console::instance->toggle();
return;
}
// if console is open: send key there
- if (Console::hasFocus()) {
+ if (Console::instance->hasFocus()) {
process_console_key_event(event);
return;
}
// default action: update controls
if(key_mapping == keymap.end()) {
- msg_debug << "Key " << event.key.keysym.sym << " is unbound" << std::endl;
+ log_debug << "Key " << event.key.keysym.sym << " is unbound" << std::endl;
return;
}
Control control = key_mapping->second;
switch (event.key.keysym.sym) {
case SDLK_RETURN:
- Console::input << std::endl;
+ Console::instance->input << std::endl;
break;
case SDLK_BACKSPACE:
- Console::backspace();
+ Console::instance->backspace();
break;
case SDLK_TAB:
- Console::autocomplete();
+ Console::instance->autocomplete();
break;
case SDLK_PAGEUP:
- Console::scroll(-1);
+ Console::instance->scroll(-1);
break;
case SDLK_PAGEDOWN:
- Console::scroll(+1);
+ Console::instance->scroll(+1);
break;
case SDLK_END:
- Console::scroll(+65535);
+ Console::instance->scroll(+65535);
break;
default:
int c = event.key.keysym.unicode;
if ((c >= 32) && (c <= 126)) {
- Console::input << (char)c;
+ Console::instance->input << (char)c;
}
break;
}
add_controlfield(Controller::LEFT, _("Left"));
add_controlfield(Controller::RIGHT, _("Right"));
add_controlfield(Controller::JUMP, _("Jump"));
- add_controlfield(Controller::ACTION, _("Shoot/Run"));
+ add_controlfield(Controller::ACTION, _("Action"));
add_hl();
add_back(_("Back"));
update();
add_hl();
if(controller->joysticks.size() > 0) {
add_controlfield(Controller::JUMP, _("Jump"));
- add_controlfield(Controller::ACTION, _("Shoot/Run"));
+ add_controlfield(Controller::ACTION, _("Action"));
add_controlfield(Controller::PAUSE_MENU, _("Pause/Menu"));
} else {
add_deactive(-1, _("No Joysticks found"));