#include <algorithm>
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "util/log.hpp"
-GameControllerManager::GameControllerManager(JoystickKeyboardController* parent) :
+GameControllerManager::GameControllerManager(InputManager* parent) :
m_parent(parent),
m_deadzone(8000),
m_game_controllers()
#include "SDL.h"
-class JoystickKeyboardController;
+class InputManager;
class GameControllerManager
{
private:
- JoystickKeyboardController* m_parent;
+ InputManager* m_parent;
int m_deadzone;
std::vector<SDL_GameController*> m_game_controllers;
public:
- GameControllerManager(JoystickKeyboardController* parent);
+ GameControllerManager(InputManager* parent);
~GameControllerManager();
void process_button_event(const SDL_ControllerButtonEvent& ev);
--- /dev/null
+// SuperTux
+// Copyright (C) 2006 Matthias Braun <matze@braunis.de>,
+// 2007 Ingo Ruhnke <grumbel@gmx.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 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, see <http://www.gnu.org/licenses/>.
+
+#include "control/input_manager.hpp"
+
+#include <iostream>
+
+#include "control/keyboard_manager.hpp"
+#include "control/joystick_manager.hpp"
+#include "control/game_controller_manager.hpp"
+#include "gui/menu_manager.hpp"
+#include "lisp/list_iterator.hpp"
+#include "supertux/gameconfig.hpp"
+#include "util/gettext.hpp"
+#include "util/writer.hpp"
+
+InputManager::InputManager() :
+ controller(new Controller),
+ m_use_game_controller(true),
+ keyboard_manager(new KeyboardManager(this)),
+ joystick_manager(new JoystickManager(this)),
+ game_controller_manager(new GameControllerManager(this))
+{
+}
+
+InputManager::~InputManager()
+{
+}
+
+Controller*
+InputManager::get_controller()
+{
+ return controller.get();
+}
+
+void
+InputManager::read(const Reader& lisp)
+{
+ const lisp::Lisp* keymap_lisp = lisp.get_lisp("keymap");
+ if (keymap_lisp)
+ {
+ keyboard_manager->read(keymap_lisp);
+ }
+
+ const lisp::Lisp* joystick_lisp = lisp.get_lisp(_("joystick"));
+ if (joystick_lisp)
+ {
+ joystick_manager->read(joystick_lisp);
+ }
+}
+
+void
+InputManager::write(Writer& writer)
+{
+ writer.start_list("keymap");
+ keyboard_manager->write(writer);
+ writer.end_list("keymap");
+
+ writer.start_list("joystick");
+ joystick_manager->write(writer);
+ writer.end_list("joystick");
+}
+
+void
+InputManager::update()
+{
+ controller->update();
+}
+
+void
+InputManager::reset()
+{
+ controller->reset();
+}
+
+void
+InputManager::process_event(const SDL_Event& event)
+{
+ switch(event.type) {
+ case SDL_TEXTINPUT:
+ keyboard_manager->process_text_input_event(event.text);
+ break;
+
+ case SDL_KEYUP:
+ case SDL_KEYDOWN:
+ keyboard_manager->process_key_event(event.key);
+ break;
+
+ case SDL_JOYAXISMOTION:
+ if (!m_use_game_controller) joystick_manager->process_axis_event(event.jaxis);
+ break;
+
+ case SDL_JOYHATMOTION:
+ if (!m_use_game_controller) joystick_manager->process_hat_event(event.jhat);
+ break;
+
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ if (!m_use_game_controller) joystick_manager->process_button_event(event.jbutton);
+ break;
+
+ case SDL_JOYDEVICEADDED:
+ if (!m_use_game_controller) joystick_manager->on_joystick_added(event.jdevice.which);
+ break;
+
+ case SDL_JOYDEVICEREMOVED:
+ if (!m_use_game_controller) joystick_manager->on_joystick_removed(event.jdevice.which);
+ break;
+
+ case SDL_CONTROLLERAXISMOTION:
+ if (m_use_game_controller) game_controller_manager->process_axis_event(event.caxis);
+ break;
+
+ case SDL_CONTROLLERBUTTONDOWN:
+ if (m_use_game_controller) game_controller_manager->process_button_event(event.cbutton);
+ break;
+
+ case SDL_CONTROLLERBUTTONUP:
+ if (m_use_game_controller) game_controller_manager->process_button_event(event.cbutton);
+ break;
+
+ case SDL_CONTROLLERDEVICEADDED:
+ std::cout << "SDL_CONTROLLERDEVICEADDED" << std::endl;
+ if (m_use_game_controller) game_controller_manager->on_controller_added(event.cdevice.which);
+ break;
+
+ case SDL_CONTROLLERDEVICEREMOVED:
+ std::cout << "SDL_CONTROLLERDEVICEREMOVED" << std::endl;
+ if (m_use_game_controller) game_controller_manager->on_controller_removed(event.cdevice.which);
+ break;
+
+ case SDL_CONTROLLERDEVICEREMAPPED:
+ std::cout << "SDL_CONTROLLERDEVICEREMAPPED" << std::endl;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/* EOF */
--- /dev/null
+// SuperTux
+// 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 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, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_CONTROL_INPUT_MANAGER_HPP
+#define HEADER_SUPERTUX_CONTROL_INPUT_MANAGER_HPP
+
+#include "control/controller.hpp"
+
+#include <SDL.h>
+#include <map>
+#include <string>
+#include <vector>
+#include <memory>
+
+#include "util/reader_fwd.hpp"
+#include "util/writer_fwd.hpp"
+
+class Controller;
+class GameControllerManager;
+class JoystickManager;
+class JoystickMenu;
+class KeyboardManager;
+class KeyboardMenu;
+class Menu;
+
+class InputManager final
+{
+private:
+ friend class KeyboardMenu;
+ friend class JoystickMenu;
+
+ typedef Controller::Control Control;
+
+public:
+ InputManager();
+ virtual ~InputManager();
+
+ void process_event(const SDL_Event& event);
+
+ void write(Writer& writer);
+ void read(const Reader& lisp);
+ void update();
+ void reset();
+
+ Controller* get_controller();
+
+private:
+ std::unique_ptr<Controller> controller;
+
+public:
+ bool m_use_game_controller;
+ std::unique_ptr<KeyboardManager> keyboard_manager;
+ std::unique_ptr<JoystickManager> joystick_manager;
+ std::unique_ptr<GameControllerManager> game_controller_manager;
+
+private:
+ InputManager(const InputManager&);
+ InputManager& operator=(const InputManager&);
+};
+
+#endif
+
+/* EOF */
#include <iostream>
#include <algorithm>
-#include "control/joystickkeyboardcontroller.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/log.hpp"
#include "util/writer.hpp"
-JoystickManager::JoystickManager(JoystickKeyboardController* parent) :
+JoystickManager::JoystickManager(InputManager* parent) :
parent(parent),
joy_button_map(),
joy_axis_map(),
#include "util/reader_fwd.hpp"
#include "util/writer_fwd.hpp"
-class JoystickKeyboardController;
+class InputManager;
class JoystickManager final
{
typedef std::map<std::pair<JoyId, int>, Controller::Control> HatMap;
private:
- JoystickKeyboardController* parent;
+ InputManager* parent;
ButtonMap joy_button_map;
AxisMap joy_axis_map;
std::vector<SDL_Joystick*> joysticks;
public:
- JoystickManager(JoystickKeyboardController* parent);
+ JoystickManager(InputManager* parent);
~JoystickManager();
void process_hat_event(const SDL_JoyHatEvent& jhat);
+++ /dev/null
-// SuperTux
-// Copyright (C) 2006 Matthias Braun <matze@braunis.de>,
-// 2007 Ingo Ruhnke <grumbel@gmx.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 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, see <http://www.gnu.org/licenses/>.
-
-#include "control/joystickkeyboardcontroller.hpp"
-
-#include <iostream>
-
-#include "control/keyboard_manager.hpp"
-#include "control/joystick_manager.hpp"
-#include "control/game_controller_manager.hpp"
-#include "gui/menu_manager.hpp"
-#include "lisp/list_iterator.hpp"
-#include "supertux/gameconfig.hpp"
-#include "util/gettext.hpp"
-#include "util/writer.hpp"
-
-JoystickKeyboardController::JoystickKeyboardController() :
- controller(new Controller),
- m_use_game_controller(true),
- keyboard_manager(new KeyboardManager(this)),
- joystick_manager(new JoystickManager(this)),
- game_controller_manager(new GameControllerManager(this))
-{
-}
-
-JoystickKeyboardController::~JoystickKeyboardController()
-{
-}
-
-Controller*
-JoystickKeyboardController::get_controller()
-{
- return controller.get();
-}
-
-void
-JoystickKeyboardController::read(const Reader& lisp)
-{
- const lisp::Lisp* keymap_lisp = lisp.get_lisp("keymap");
- if (keymap_lisp)
- {
- keyboard_manager->read(keymap_lisp);
- }
-
- const lisp::Lisp* joystick_lisp = lisp.get_lisp(_("joystick"));
- if (joystick_lisp)
- {
- joystick_manager->read(joystick_lisp);
- }
-}
-
-void
-JoystickKeyboardController::write(Writer& writer)
-{
- writer.start_list("keymap");
- keyboard_manager->write(writer);
- writer.end_list("keymap");
-
- writer.start_list("joystick");
- joystick_manager->write(writer);
- writer.end_list("joystick");
-}
-
-void
-JoystickKeyboardController::update()
-{
- controller->update();
-}
-
-void
-JoystickKeyboardController::reset()
-{
- controller->reset();
-}
-
-void
-JoystickKeyboardController::process_event(const SDL_Event& event)
-{
- switch(event.type) {
- case SDL_TEXTINPUT:
- keyboard_manager->process_text_input_event(event.text);
- break;
-
- case SDL_KEYUP:
- case SDL_KEYDOWN:
- keyboard_manager->process_key_event(event.key);
- break;
-
- case SDL_JOYAXISMOTION:
- if (!m_use_game_controller) joystick_manager->process_axis_event(event.jaxis);
- break;
-
- case SDL_JOYHATMOTION:
- if (!m_use_game_controller) joystick_manager->process_hat_event(event.jhat);
- break;
-
- case SDL_JOYBUTTONDOWN:
- case SDL_JOYBUTTONUP:
- if (!m_use_game_controller) joystick_manager->process_button_event(event.jbutton);
- break;
-
- case SDL_JOYDEVICEADDED:
- if (!m_use_game_controller) joystick_manager->on_joystick_added(event.jdevice.which);
- break;
-
- case SDL_JOYDEVICEREMOVED:
- if (!m_use_game_controller) joystick_manager->on_joystick_removed(event.jdevice.which);
- break;
-
- case SDL_CONTROLLERAXISMOTION:
- if (m_use_game_controller) game_controller_manager->process_axis_event(event.caxis);
- break;
-
- case SDL_CONTROLLERBUTTONDOWN:
- if (m_use_game_controller) game_controller_manager->process_button_event(event.cbutton);
- break;
-
- case SDL_CONTROLLERBUTTONUP:
- if (m_use_game_controller) game_controller_manager->process_button_event(event.cbutton);
- break;
-
- case SDL_CONTROLLERDEVICEADDED:
- std::cout << "SDL_CONTROLLERDEVICEADDED" << std::endl;
- if (m_use_game_controller) game_controller_manager->on_controller_added(event.cdevice.which);
- break;
-
- case SDL_CONTROLLERDEVICEREMOVED:
- std::cout << "SDL_CONTROLLERDEVICEREMOVED" << std::endl;
- if (m_use_game_controller) game_controller_manager->on_controller_removed(event.cdevice.which);
- break;
-
- case SDL_CONTROLLERDEVICEREMAPPED:
- std::cout << "SDL_CONTROLLERDEVICEREMAPPED" << std::endl;
- break;
-
- default:
- break;
- }
-}
-
-/* EOF */
+++ /dev/null
-// SuperTux
-// 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 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_SUPERTUX_CONTROL_JOYSTICKKEYBOARDCONTROLLER_HPP
-#define HEADER_SUPERTUX_CONTROL_JOYSTICKKEYBOARDCONTROLLER_HPP
-
-#include "control/controller.hpp"
-
-#include <SDL.h>
-#include <map>
-#include <string>
-#include <vector>
-#include <memory>
-
-#include "util/reader_fwd.hpp"
-#include "util/writer_fwd.hpp"
-
-class Controller;
-class GameControllerManager;
-class JoystickManager;
-class JoystickMenu;
-class KeyboardManager;
-class KeyboardMenu;
-class Menu;
-
-class JoystickKeyboardController final
-{
-private:
- friend class KeyboardMenu;
- friend class JoystickMenu;
-
- typedef Controller::Control Control;
-
-public:
- JoystickKeyboardController();
- virtual ~JoystickKeyboardController();
-
- void process_event(const SDL_Event& event);
-
- void write(Writer& writer);
- void read(const Reader& lisp);
- void update();
- void reset();
-
- Controller* get_controller();
-
-private:
- std::unique_ptr<Controller> controller;
-
-public:
- bool m_use_game_controller;
- std::unique_ptr<KeyboardManager> keyboard_manager;
- std::unique_ptr<JoystickManager> joystick_manager;
- std::unique_ptr<GameControllerManager> game_controller_manager;
-
-private:
- JoystickKeyboardController(const JoystickKeyboardController&);
- JoystickKeyboardController& operator=(const JoystickKeyboardController&);
-};
-
-#endif
-
-/* EOF */
#include "supertux/menu/menu_storage.hpp"
#include "util/writer.hpp"
-KeyboardManager::KeyboardManager(JoystickKeyboardController* parent) :
+KeyboardManager::KeyboardManager(InputManager* parent) :
m_parent(parent),
keymap(),
jump_with_up_kbd(false),
#include "util/reader_fwd.hpp"
#include "util/writer_fwd.hpp"
-class JoystickKeyboardController;
+class InputManager;
class KeyboardManager final
{
typedef std::map<SDL_Keycode, Controller::Control> KeyMap;
public:
- KeyboardManager(JoystickKeyboardController* parent);
+ KeyboardManager(InputManager* parent);
~KeyboardManager();
void process_key_event(const SDL_KeyboardEvent& event);
void write(Writer& writer);
private:
- JoystickKeyboardController* m_parent;
+ InputManager* m_parent;
KeyMap keymap;
bool jump_with_up_kbd;
int wait_for_key;
#include <math.h>
#include <stdexcept>
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu_item.hpp"
#include "gui/menu_manager.hpp"
#include "gui/mousecursor.hpp"
#include "supertux/globals.hpp"
-#include "supertux/screen_manager.hpp"
#include "supertux/resources.hpp"
+#include "supertux/screen_manager.hpp"
#include "supertux/timer.hpp"
#include "util/gettext.hpp"
#include "video/drawing_context.hpp"
effect_progress = 0.0f;
}
- Controller* controller = g_jk_controller->get_controller();
+ Controller* controller = g_input_manager->get_controller();
/** check main input controller... */
if(controller->pressed(Controller::UP)) {
menuaction = MENU_ACTION_UP;
#include "gui/menu_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu.hpp"
#include "supertux/globals.hpp"
#include "supertux/timer.hpp"
}
// just to be sure...
- g_jk_controller->reset();
+ g_input_manager->reset();
}
void
#include "audio/sound_manager.hpp"
#include "badguy/badguy.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "math/random_generator.hpp"
#include "object/bullet.hpp"
#include "object/camera.hpp"
climbing(0)
{
this->name = name;
- controller = g_jk_controller->get_controller();
+ controller = g_input_manager->get_controller();
scripting_controller.reset(new CodeController());
// if/when we have complete penny gfx, we can
// load those instead of Tux's sprite in the
#include <fstream>
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
#include "math/random_generator.hpp"
game_pause = false;
end_sequence = 0;
- g_jk_controller->reset();
+ g_input_manager->reset();
currentsector = 0;
// save input for demo?
if(capture_demo_stream != 0) {
- Controller *controller = g_jk_controller->get_controller();
+ Controller *controller = g_input_manager->get_controller();
capture_demo_stream ->put(controller->hold(Controller::LEFT));
capture_demo_stream ->put(controller->hold(Controller::RIGHT));
capture_demo_stream ->put(controller->hold(Controller::UP));
GameSession::update(float elapsed_time)
{
// handle controller
- if(g_jk_controller->get_controller()->pressed(Controller::PAUSE_MENU))
+ if(g_input_manager->get_controller()->pressed(Controller::PAUSE_MENU))
on_escape_press();
process_events();
#include <stdexcept>
#include "addon/addon_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "lisp/writer.hpp"
#include "lisp/parser.hpp"
#include "util/reader.hpp"
}
const lisp::Lisp* config_control_lisp = config_lisp->get_lisp("control");
- if(config_control_lisp && g_jk_controller) {
- g_jk_controller->read(*config_control_lisp);
+ if(config_control_lisp && g_input_manager) {
+ g_input_manager->read(*config_control_lisp);
}
const lisp::Lisp* config_addons_lisp = config_lisp->get_lisp("addons");
writer.write("music_enabled", music_enabled);
writer.end_list("audio");
- if(g_jk_controller) {
+ if(g_input_manager) {
writer.start_list("control");
- g_jk_controller->write(writer);
+ g_input_manager->write(writer);
writer.end_list("control");
}
#include "supertux/globals.hpp"
#include <tinygettext/tinygettext.hpp>
-JoystickKeyboardController* g_jk_controller = 0;
+InputManager* g_input_manager = 0;
tinygettext::DictionaryManager* dictionary_manager = 0;
int SCREEN_WIDTH;
typedef struct SDL_Surface SDL_Surface;
namespace tinygettext { class DictionaryManager; }
class Config;
-class JoystickKeyboardController;
+class InputManager;
class PlayerStatus;
class ScreenManager;
class SoundManager;
extern int SCREEN_HEIGHT;
// global variables
-extern JoystickKeyboardController* g_jk_controller;
+extern InputManager* g_input_manager;
extern ScreenManager* g_screen_manager;
#include "supertux/levelintro.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "math/random_generator.hpp"
#include "sprite/sprite_manager.hpp"
#include "supertux/fadeout.hpp"
void
LevelIntro::update(float elapsed_time)
{
- Controller *controller = g_jk_controller->get_controller();
+ Controller *controller = g_input_manager->get_controller();
// Check if it's time to exit the screen
if(controller->pressed(Controller::JUMP)
#include "addon/addon_manager.hpp"
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "math/random_generator.hpp"
#include "physfs/ifile_stream.hpp"
#include "physfs/physfs_sdl.hpp"
Console::instance = new Console();
timelog("controller");
- g_jk_controller = new JoystickKeyboardController();
+ g_input_manager = new InputManager();
timelog("config");
init_config();
g_config->save();
delete g_config;
g_config = NULL;
- delete g_jk_controller;
- g_jk_controller = NULL;
+ delete g_input_manager;
+ g_input_manager = NULL;
delete Console::instance;
Console::instance = NULL;
scripting::exit_squirrel();
#include "control/joystick_manager.hpp"
#include "util/gettext.hpp"
-JoystickMenu::JoystickMenu(JoystickKeyboardController* _controller) :
+JoystickMenu::JoystickMenu(InputManager* _controller) :
controller(_controller),
joysticks_available(false)
{
#ifndef HEADER_SUPERTUX_CONTROL_JOYSTICK_MENU_HPP
#define HEADER_SUPERTUX_CONTROL_JOYSTICK_MENU_HPP
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu_item.hpp"
class JoystickMenu : public Menu
{
public:
- JoystickMenu(JoystickKeyboardController* controller);
+ JoystickMenu(InputManager* controller);
virtual ~JoystickMenu();
void update();
void recreateMenu();
private:
- JoystickKeyboardController* controller;
+ InputManager* controller;
bool joysticks_available;
private:
#include "supertux/globals.hpp"
#include "util/gettext.hpp"
-KeyboardMenu::KeyboardMenu(JoystickKeyboardController* _controller) :
+KeyboardMenu::KeyboardMenu(InputManager* _controller) :
controller(_controller)
{
add_label(_("Setup Keyboard"));
#ifndef HEADER_SUPERTUX_CONTROL_KEYBOARD_MENU_HPP
#define HEADER_SUPERTUX_CONTROL_KEYBOARD_MENU_HPP
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu_item.hpp"
class KeyboardMenu : public Menu
{
public:
- KeyboardMenu(JoystickKeyboardController* controller);
+ KeyboardMenu(InputManager* controller);
~KeyboardMenu();
void update();
std::string get_key_name(SDL_Keycode key);
virtual void menu_action(MenuItem* item);
- JoystickKeyboardController* controller;
+ InputManager* controller;
void check_menu() {}
private:
KeyboardMenu(const KeyboardMenu&);
{
if (!key_options_menu)
{ // FIXME: this in never freed
- key_options_menu = new KeyboardMenu(g_jk_controller);
+ key_options_menu = new KeyboardMenu(g_input_manager);
}
return key_options_menu;
{
if (!joystick_options_menu)
{ // FIXME: this in never freed
- joystick_options_menu = new JoystickMenu(g_jk_controller);
+ joystick_options_menu = new JoystickMenu(g_input_manager);
}
return joystick_options_menu;
#include "supertux/screen_manager.hpp"
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
#include "scripting/squirrel_util.hpp"
void
ScreenManager::process_events()
{
- g_jk_controller->update();
+ g_input_manager->update();
SDL_Event event;
while(SDL_PollEvent(&event))
{
- g_jk_controller->process_event(event);
+ g_input_manager->process_event(event);
if(MenuManager::current() != NULL)
MenuManager::current()->event(event);
#include "supertux/textscroller.hpp"
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "lisp/parser.hpp"
#include "supertux/fadeout.hpp"
#include "supertux/info_box_line.hpp"
void
TextScroller::update(float elapsed_time)
{
- Controller *controller = g_jk_controller->get_controller();
+ Controller *controller = g_input_manager->get_controller();
if(controller->hold(Controller::UP)) {
speed = -defaultspeed*5;
} else if(controller->hold(Controller::DOWN)) {
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "scripting/squirrel_util.hpp"
#include "sprite/sprite.hpp"
#include "sprite/sprite_manager.hpp"
void
Tux::updateInputDirection()
{
- Controller* controller = g_jk_controller->get_controller();
+ Controller* controller = g_input_manager->get_controller();
if(controller->hold(Controller::UP))
input_direction = D_NORTH;
else if(controller->hold(Controller::DOWN))
#include <vector>
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
+#include "control/input_manager.hpp"
#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
#include "gui/mousecursor.hpp"
}
// handle input
- Controller *controller = g_jk_controller->get_controller();
+ Controller *controller = g_input_manager->get_controller();
bool enter_level = false;
if(controller->pressed(Controller::ACTION)
|| controller->pressed(Controller::JUMP)