// SuperTux
-// Copyright (C) 2013 Ingo Ruhnke <grumbel@gmx.de>
+// Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
//
// 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
#include <iostream>
#include <algorithm>
+#include "gui/menu_manager.hpp"
#include "control/input_manager.hpp"
#include "lisp/list_iterator.hpp"
#include "supertux/menu/joystick_menu.hpp"
-#include "supertux/menu/menu_storage.hpp"
#include "util/gettext.hpp"
#include "util/log.hpp"
#include "util/writer.hpp"
-JoystickManager::JoystickManager(InputManager* parent) :
- parent(parent),
+JoystickManager::JoystickManager(InputManager* parent_) :
+ parent(parent_),
joy_button_map(),
joy_axis_map(),
joy_hat_map(),
void
JoystickManager::on_joystick_added(int joystick_index)
{
- std::cout << "joydeviceadded: " << joystick_index << std::endl;
+ log_debug << "on_joystick_added(): " << joystick_index << std::endl;
SDL_Joystick* joystick = SDL_JoystickOpen(joystick_index);
if (!joystick)
{
void
JoystickManager::on_joystick_removed(int instance_id)
{
- std::cout << "joydeviceremoved: " << static_cast<int>(instance_id) << std::endl;
+ log_debug << "on_joystick_removed: " << static_cast<int>(instance_id) << std::endl;
for(auto& joy : joysticks)
{
SDL_JoystickID id = SDL_JoystickInstanceID(joy);
if (changed & SDL_HAT_RIGHT && jhat.value & SDL_HAT_RIGHT)
bind_joyhat(jhat.which, SDL_HAT_RIGHT, Controller::Control(wait_for_joystick));
- MenuStorage::instance().get_joystick_options_menu()->update();
+ MenuManager::instance().refresh();
wait_for_joystick = -1;
}
else
else
bind_joyaxis(jaxis.which, jaxis.axis + 1, Controller::Control(wait_for_joystick));
- MenuStorage::instance().get_joystick_options_menu()->update();
+ MenuManager::instance().refresh();
wait_for_joystick = -1;
}
}
if(jbutton.state == SDL_PRESSED)
{
bind_joybutton(jbutton.which, jbutton.button, (Controller::Control)wait_for_joystick);
- MenuStorage::instance().get_joystick_options_menu()->update();
+ MenuManager::instance().refresh();
parent->reset();
wait_for_joystick = -1;
}