Browse Source

Add files in the input folder to the input namespace

master
C. J. Howard 8 months ago
parent
commit
2db97b5d53
39 changed files with 524 additions and 434 deletions
  1. +1
    -0
      CMakeLists.txt
  2. +8
    -11
      src/application.cpp
  3. +13
    -13
      src/application.hpp
  4. +2
    -2
      src/ecs/systems/control-system.cpp
  5. +81
    -81
      src/ecs/systems/control-system.hpp
  6. +1
    -2
      src/ecs/systems/ui-system.cpp
  7. +3
    -3
      src/ecs/systems/ui-system.hpp
  8. +5
    -5
      src/event/input-events.cpp
  9. +20
    -23
      src/event/input-events.hpp
  10. +58
    -58
      src/game/bootloader.cpp
  11. +15
    -15
      src/game/game-context.hpp
  12. +1
    -1
      src/game/states/map-state.cpp
  13. +1
    -1
      src/game/states/splash-state.cpp
  14. +3
    -0
      src/input/control-set.cpp
  15. +7
    -3
      src/input/control-set.hpp
  16. +3
    -0
      src/input/control.cpp
  17. +7
    -5
      src/input/control.hpp
  18. +7
    -4
      src/input/device.cpp
  19. +9
    -7
      src/input/device.hpp
  20. +44
    -41
      src/input/event-router.cpp
  21. +12
    -8
      src/input/event-router.hpp
  22. +17
    -13
      src/input/game-controller.cpp
  23. +9
    -5
      src/input/game-controller.hpp
  24. +12
    -0
      src/input/input.hpp
  25. +7
    -4
      src/input/keyboard.cpp
  26. +9
    -5
      src/input/keyboard.hpp
  27. +16
    -12
      src/input/listener.cpp
  28. +8
    -5
      src/input/listener.hpp
  29. +18
    -15
      src/input/mapper.cpp
  30. +13
    -10
      src/input/mapper.hpp
  31. +21
    -18
      src/input/mapping.cpp
  32. +46
    -42
      src/input/mapping.hpp
  33. +11
    -8
      src/input/mouse.cpp
  34. +9
    -5
      src/input/mouse.hpp
  35. +7
    -3
      src/input/scancode.hpp
  36. +3
    -0
      src/input/sdl-game-controller-tables.cpp
  37. +7
    -3
      src/input/sdl-game-controller-tables.hpp
  38. +3
    -0
      src/input/sdl-scancode-table.cpp
  39. +7
    -3
      src/input/sdl-scancode-table.hpp

+ 1
- 0
CMakeLists.txt View File

@ -14,6 +14,7 @@ find_package(SDL2 REQUIRED COMPONENTS SDL2::SDL2-static SDL2::SDL2main CONFIG)
find_package(OpenAL REQUIRED CONFIG)
find_library(physfs REQUIRED NAMES physfs-static PATHS "${CMAKE_PREFIX_PATH}/lib")
# Determine dependencies
set(STATIC_LIBS
dr_wav

+ 8
- 11
src/application.cpp View File

@ -26,9 +26,6 @@
#include "input/scancode.hpp"
#include "input/sdl-game-controller-tables.hpp"
#include "input/sdl-scancode-table.hpp"
#include "input/keyboard.hpp"
#include "input/mouse.hpp"
#include "input/game-controller.hpp"
#include "resources/image.hpp"
#include <SDL2/SDL.h>
#include <glad/glad.h>
@ -208,9 +205,9 @@ application::application():
event_dispatcher = new ::event_dispatcher();
// Setup input
keyboard = new ::keyboard();
keyboard = new input::keyboard();
keyboard->set_event_dispatcher(event_dispatcher);
mouse = new ::mouse();
mouse = new input::mouse();
mouse->set_event_dispatcher(event_dispatcher);
// Setup frame scheduler
@ -481,10 +478,10 @@ void application::translate_sdl_events()
{
if (sdl_event.key.repeat == 0)
{
scancode scancode = scancode::unknown;
input::scancode scancode = input::scancode::unknown;
if (sdl_event.key.keysym.scancode <= SDL_SCANCODE_APP2)
{
scancode = sdl_scancode_table[sdl_event.key.keysym.scancode];
scancode = input::sdl_scancode_table[sdl_event.key.keysym.scancode];
}
if (sdl_event.type == SDL_KEYDOWN)
@ -526,7 +523,7 @@ void application::translate_sdl_events()
{
if (auto it = game_controller_map.find(sdl_event.cdevice.which); it != game_controller_map.end())
{
game_controller_button button = sdl_button_table[sdl_event.cbutton.button];
input::game_controller_button button = input::sdl_button_table[sdl_event.cbutton.button];
it->second->press(button);
}
}
@ -539,7 +536,7 @@ void application::translate_sdl_events()
{
if (auto it = game_controller_map.find(sdl_event.cdevice.which); it != game_controller_map.end())
{
game_controller_button button = sdl_button_table[sdl_event.cbutton.button];
input::game_controller_button button = input::sdl_button_table[sdl_event.cbutton.button];
it->second->release(button);
}
}
@ -552,7 +549,7 @@ void application::translate_sdl_events()
{
if (auto it = game_controller_map.find(sdl_event.cdevice.which); it != game_controller_map.end())
{
game_controller_axis axis = sdl_axis_table[sdl_event.caxis.axis];
input::game_controller_axis axis = input::sdl_axis_table[sdl_event.caxis.axis];
float value = sdl_event.caxis.value;
value /= (value < 0.0f) ? 32768.0f : 32767.0f;
it->second->move(axis, value);
@ -580,7 +577,7 @@ void application::translate_sdl_events()
{
logger->log("Connected game controller \"" + controller_name + "\"");
game_controller* controller = new game_controller();
input::game_controller* controller = new input::game_controller();
controller->set_event_dispatcher(event_dispatcher);
game_controllers.push_back(controller);
game_controller_map[sdl_event.cdevice.which] = controller;

+ 13
- 13
src/application.hpp View File

@ -26,15 +26,15 @@
#include <memory>
#include <unordered_map>
#include "gl/rasterizer.hpp"
#include "input/keyboard.hpp"
#include "input/mouse.hpp"
#include "input/game-controller.hpp"
// Forward declarations
typedef struct SDL_Window SDL_Window;
typedef void* SDL_GLContext;
class event_dispatcher;
class frame_scheduler;
class game_controller;
class keyboard;
class mouse;
class image;
namespace debug
@ -186,13 +186,13 @@ public:
debug::logger* get_logger();
/// Returns the virtual keyboard.
::keyboard* get_keyboard();
input::keyboard* get_keyboard();
/// Returns the virtual mouse.
::mouse* get_mouse();
input::mouse* get_mouse();
/// Returns the list of virtual game controllers.
const std::list<game_controller*>& get_game_controllers();
const std::list<input::game_controller*>& get_game_controllers();
/// Returns the application's event dispatcher.
event_dispatcher* get_event_dispatcher();
@ -232,10 +232,10 @@ private:
event_dispatcher* event_dispatcher;
// Input devices
keyboard* keyboard;
mouse* mouse;
std::list<game_controller*> game_controllers;
std::unordered_map<int, game_controller*> game_controller_map;
input::keyboard* keyboard;
input::mouse* mouse;
std::list<input::game_controller*> game_controllers;
std::unordered_map<int, input::game_controller*> game_controller_map;
};
inline debug::logger* application::get_logger()
@ -268,17 +268,17 @@ inline gl::rasterizer* application::get_rasterizer()
return rasterizer;
}
inline keyboard* application::get_keyboard()
inline input::keyboard* application::get_keyboard()
{
return keyboard;
}
inline mouse* application::get_mouse()
inline input::mouse* application::get_mouse()
{
return mouse;
}
inline const std::list<game_controller*>& application::get_game_controllers()
inline const std::list<input::game_controller*>& application::get_game_controllers()
{
return game_controllers;
}

+ 2
- 2
src/ecs/systems/control-system.cpp View File

@ -65,8 +65,8 @@ control_system::control_system(ecs::registry& registry):
control_set.add_control(&rewind_control);
// Set deadzone at 15% for all controls
const std::list<control*>* controls = control_set.get_controls();
for (control* control: *controls)
const std::list<input::control*>* controls = control_set.get_controls();
for (input::control* control: *controls)
{
control->set_deadzone(0.15f);
}

+ 81
- 81
src/ecs/systems/control-system.hpp View File

@ -59,65 +59,65 @@ public:
void set_viewport(const float4& viewport);
void set_underworld_camera(scene::camera* camera);
control_set* get_control_set();
control* get_move_forward_control();
control* get_move_back_control();
control* get_move_left_control();
control* get_move_right_control();
control* get_rotate_ccw_control();
control* get_rotate_cw_control();
control* get_tilt_up_control();
control* get_tilt_down_control();
control* get_zoom_in_control();
control* get_zoom_out_control();
control* get_adjust_camera_control();
control* get_ascend_control();
control* get_descend_control();
control* get_toggle_view_control();
control* get_tool_menu_control();
control* get_equip_lens_control();
control* get_equip_brush_control();
control* get_equip_forceps_control();
control* get_equip_marker_control();
control* get_equip_container_control();
control* get_equip_twig_control();
control* get_next_marker_control();
control* get_previous_marker_control();
control* get_use_tool_control();
control* get_fast_forward_control();
control* get_rewind_control();
input::control_set* get_control_set();
input::control* get_move_forward_control();
input::control* get_move_back_control();
input::control* get_move_left_control();
input::control* get_move_right_control();
input::control* get_rotate_ccw_control();
input::control* get_rotate_cw_control();
input::control* get_tilt_up_control();
input::control* get_tilt_down_control();
input::control* get_zoom_in_control();
input::control* get_zoom_out_control();
input::control* get_adjust_camera_control();
input::control* get_ascend_control();
input::control* get_descend_control();
input::control* get_toggle_view_control();
input::control* get_tool_menu_control();
input::control* get_equip_lens_control();
input::control* get_equip_brush_control();
input::control* get_equip_forceps_control();
input::control* get_equip_marker_control();
input::control* get_equip_container_control();
input::control* get_equip_twig_control();
input::control* get_next_marker_control();
input::control* get_previous_marker_control();
input::control* get_use_tool_control();
input::control* get_fast_forward_control();
input::control* get_rewind_control();
private:
virtual void handle_event(const mouse_moved_event& event);
virtual void handle_event(const window_resized_event& event);
control_set control_set;
control move_forward_control;
control move_back_control;
control move_left_control;
control move_right_control;
control rotate_ccw_control;
control rotate_cw_control;
control tilt_up_control;
control tilt_down_control;
control zoom_in_control;
control zoom_out_control;
control adjust_camera_control;
control ascend_control;
control descend_control;
control toggle_view_control;
control tool_menu_control;
control equip_lens_control;
control equip_brush_control;
control equip_forceps_control;
control equip_marker_control;
control equip_container_control;
control equip_twig_control;
control next_marker_control;
control previous_marker_control;
control use_tool_control;
control fast_forward_control;
control rewind_control;
input::control_set control_set;
input::control move_forward_control;
input::control move_back_control;
input::control move_left_control;
input::control move_right_control;
input::control rotate_ccw_control;
input::control rotate_cw_control;
input::control tilt_up_control;
input::control tilt_down_control;
input::control zoom_in_control;
input::control zoom_out_control;
input::control adjust_camera_control;
input::control ascend_control;
input::control descend_control;
input::control toggle_view_control;
input::control tool_menu_control;
input::control equip_lens_control;
input::control equip_brush_control;
input::control equip_forceps_control;
input::control equip_marker_control;
input::control equip_container_control;
input::control equip_twig_control;
input::control next_marker_control;
input::control previous_marker_control;
input::control use_tool_control;
input::control fast_forward_control;
input::control rewind_control;
float zoom_speed;
float min_elevation;
@ -152,137 +152,137 @@ private:
float flashlight_turns_f;
};
inline control_set* control_system::get_control_set()
inline input::control_set* control_system::get_control_set()
{
return &control_set;
}
inline control* control_system::get_move_forward_control()
inline input::control* control_system::get_move_forward_control()
{
return &move_forward_control;
}
inline control* control_system::get_move_back_control()
inline input::control* control_system::get_move_back_control()
{
return &move_back_control;
}
inline control* control_system::get_move_left_control()
inline input::control* control_system::get_move_left_control()
{
return &move_left_control;
}
inline control* control_system::get_move_right_control()
inline input::control* control_system::get_move_right_control()
{
return &move_right_control;
}
inline control* control_system::get_rotate_ccw_control()
inline input::control* control_system::get_rotate_ccw_control()
{
return &rotate_ccw_control;
}
inline control* control_system::get_rotate_cw_control()
inline input::control* control_system::get_rotate_cw_control()
{
return &rotate_cw_control;
}
inline control* control_system::get_tilt_up_control()
inline input::control* control_system::get_tilt_up_control()
{
return &tilt_up_control;
}
inline control* control_system::get_tilt_down_control()
inline input::control* control_system::get_tilt_down_control()
{
return &tilt_down_control;
}
inline control* control_system::get_zoom_in_control()
inline input::control* control_system::get_zoom_in_control()
{
return &zoom_in_control;
}
inline control* control_system::get_zoom_out_control()
inline input::control* control_system::get_zoom_out_control()
{
return &zoom_out_control;
}
inline control* control_system::get_adjust_camera_control()
inline input::control* control_system::get_adjust_camera_control()
{
return &adjust_camera_control;
}
inline control* control_system::get_ascend_control()
inline input::control* control_system::get_ascend_control()
{
return &ascend_control;
}
inline control* control_system::get_descend_control()
inline input::control* control_system::get_descend_control()
{
return &descend_control;
}
inline control* control_system::get_toggle_view_control()
inline input::control* control_system::get_toggle_view_control()
{
return &toggle_view_control;
}
inline control* control_system::get_tool_menu_control()
inline input::control* control_system::get_tool_menu_control()
{
return &tool_menu_control;
}
inline control* control_system::get_equip_lens_control()
inline input::control* control_system::get_equip_lens_control()
{
return &equip_lens_control;
}
inline control* control_system::get_equip_brush_control()
inline input::control* control_system::get_equip_brush_control()
{
return &equip_brush_control;
}
inline control* control_system::get_equip_forceps_control()
inline input::control* control_system::get_equip_forceps_control()
{
return &equip_forceps_control;
}
inline control* control_system::get_equip_marker_control()
inline input::control* control_system::get_equip_marker_control()
{
return &equip_marker_control;
}
inline control* control_system::get_equip_container_control()
inline input::control* control_system::get_equip_container_control()
{
return &equip_container_control;
}
inline control* control_system::get_equip_twig_control()
inline input::control* control_system::get_equip_twig_control()
{
return &equip_twig_control;
}
inline control* control_system::get_next_marker_control()
inline input::control* control_system::get_next_marker_control()
{
return &next_marker_control;
}
inline control* control_system::get_previous_marker_control()
inline input::control* control_system::get_previous_marker_control()
{
return &previous_marker_control;
}
inline control* control_system::get_use_tool_control()
inline input::control* control_system::get_use_tool_control()
{
return &use_tool_control;
}
inline control* control_system::get_fast_forward_control()
inline input::control* control_system::get_fast_forward_control()
{
return &fast_forward_control;
}
inline control* control_system::get_rewind_control()
inline input::control* control_system::get_rewind_control()
{
return &rewind_control;
}

+ 1
- 2
src/ecs/systems/ui-system.cpp View File

@ -18,7 +18,6 @@
*/
#include "ui-system.hpp"
#include "input/control.hpp"
#include "resources/resource-manager.hpp"
namespace ecs {
@ -85,7 +84,7 @@ void ui_system::set_viewport(const float4& viewport)
update_projection();
}
void ui_system::set_tool_menu_control(control* control)
void ui_system::set_tool_menu_control(input::control* control)
{
tool_menu_control = control;
tool_menu_control->set_activated_callback(std::bind(&ui_system::open_tool_menu, this));

+ 3
- 3
src/ecs/systems/ui-system.hpp View File

@ -31,8 +31,8 @@
#include "scene/billboard.hpp"
#include "renderer/material.hpp"
#include "math/math.hpp"
#include "input/control.hpp"
class control;
class resource_manager;
namespace ecs {
@ -47,7 +47,7 @@ public:
void update(float dt);
void set_viewport(const float4& viewport);
void set_tool_menu_control(control* control);
void set_tool_menu_control(input::control* control);
void set_camera(scene::camera* camera);
void set_scene(scene::collection* collection);
@ -81,7 +81,7 @@ private:
float4 viewport;
float2 viewport_center;
float2 tool_selection_vector;
control* tool_menu_control;
input::control* tool_menu_control;
};
} // namespace ecs

+ 5
- 5
src/event/input-events.cpp View File

@ -78,7 +78,7 @@ event_base* mouse_wheel_scrolled_event::clone() const
event_base* game_controller_connected_event::clone() const
{
game_controller_connected_event* event = new game_controller_connected_event();
event->game_controller = game_controller;
event->controller = controller;
event->reconnected = reconnected;
return event;
}
@ -86,14 +86,14 @@ event_base* game_controller_connected_event::clone() const
event_base* game_controller_disconnected_event::clone() const
{
game_controller_disconnected_event* event = new game_controller_disconnected_event();
event->game_controller = game_controller;
event->controller = controller;
return event;
}
event_base* game_controller_button_pressed_event::clone() const
{
game_controller_button_pressed_event* event = new game_controller_button_pressed_event();
event->game_controller = game_controller;
event->controller = controller;
event->button = button;
return event;
}
@ -101,7 +101,7 @@ event_base* game_controller_button_pressed_event::clone() const
event_base* game_controller_button_released_event::clone() const
{
game_controller_button_released_event* event = new game_controller_button_released_event();
event->game_controller = game_controller;
event->controller = controller;
event->button = button;
return event;
}
@ -109,7 +109,7 @@ event_base* game_controller_button_released_event::clone() const
event_base* game_controller_axis_moved_event::clone() const
{
game_controller_axis_moved_event* event = new game_controller_axis_moved_event();
event->game_controller = game_controller;
event->controller = controller;
event->axis = axis;
event->value = value;
return event;

+ 20
- 23
src/event/input-events.hpp View File

@ -21,13 +21,10 @@
#define ANTKEEPER_INPUT_EVENTS_HPP
#include "event/event.hpp"
enum class scancode;
enum class game_controller_axis;
enum class game_controller_button;
class keyboard;
class mouse;
class game_controller;
#include "input/scancode.hpp"
#include "input/keyboard.hpp"
#include "input/mouse.hpp"
#include "input/game-controller.hpp"
/**
* Input event which indicates a keyboard key has been pressed.
@ -37,8 +34,8 @@ class key_pressed_event: public event
public:
virtual event_base* clone() const;
keyboard* keyboard;
scancode scancode;
input::keyboard* keyboard;
input::scancode scancode;
};
/**
@ -49,8 +46,8 @@ class key_released_event: public event
public:
virtual event_base* clone() const;
keyboard* keyboard;
scancode scancode;
input::keyboard* keyboard;
input::scancode scancode;
};
/**
@ -61,7 +58,7 @@ class mouse_moved_event: public event
public:
virtual event_base* clone() const;
mouse* mouse;
input::mouse* mouse;
int x;
int y;
int dx;
@ -76,7 +73,7 @@ class mouse_button_pressed_event: public event
public:
virtual event_base* clone() const;
mouse* mouse;
input::mouse* mouse;
int button;
int x;
int y;
@ -90,7 +87,7 @@ class mouse_button_released_event: public event
public:
virtual event_base* clone() const;
mouse* mouse;
input::mouse* mouse;
int button;
int x;
int y;
@ -104,7 +101,7 @@ class mouse_wheel_scrolled_event: public event
public:
virtual event_base* clone() const;
mouse* mouse;
input::mouse* mouse;
int x;
int y;
};
@ -117,7 +114,7 @@ class game_controller_connected_event: public event
public:
virtual event_base* clone() const;
game_controller* game_controller;
input::game_controller* controller;
bool reconnected;
};
@ -129,7 +126,7 @@ class game_controller_disconnected_event: public event
public:
virtual event_base* clone() const;
game_controller* game_controller;
input::game_controller* controller;
};
/**
@ -140,8 +137,8 @@ class game_controller_button_pressed_event: public event
public:
virtual event_base* clone() const;
game_controller* game_controller;
game_controller_button button;
input::game_controller* controller;
input::game_controller_button button;
};
/**
@ -152,8 +149,8 @@ class game_controller_button_released_event: public event
public:
virtual event_base* clone() const;
game_controller* game_controller;
game_controller_button button;
input::game_controller* controller;
input::game_controller_button button;
};
/**
@ -164,8 +161,8 @@ class game_controller_axis_moved_event: public event
public:
virtual event_base* clone() const;
game_controller* game_controller;
game_controller_axis axis;
input::game_controller* controller;
input::game_controller_axis axis;
float value;
};

+ 58
- 58
src/game/bootloader.cpp View File

@ -80,9 +80,9 @@
#include "ecs/commands.hpp"
#include "utility/paths.hpp"
#include "event/event-dispatcher.hpp"
#include "input/input-event-router.hpp"
#include "input/input-mapper.hpp"
#include "input/input-listener.hpp"
#include "input/event-router.hpp"
#include "input/mapper.hpp"
#include "input/listener.hpp"
#include "input/game-controller.hpp"
#include "input/mouse.hpp"
#include "input/keyboard.hpp"
@ -933,19 +933,19 @@ void setup_controls(game_context* ctx)
event_dispatcher* event_dispatcher = ctx->app->get_event_dispatcher();
// Setup input event routing
ctx->input_event_router = new input_event_router();
ctx->input_event_router = new input::event_router();
ctx->input_event_router->set_event_dispatcher(event_dispatcher);
// Setup input mapper
ctx->input_mapper = new input_mapper();
ctx->input_mapper = new input::mapper();
ctx->input_mapper->set_event_dispatcher(event_dispatcher);
// Setup input listener
ctx->input_listener = new input_listener();
ctx->input_listener = new input::listener();
ctx->input_listener->set_event_dispatcher(event_dispatcher);
// Create toggle fullscreen control
ctx->toggle_fullscreen_control = new control();
ctx->toggle_fullscreen_control = new input::control();
ctx->toggle_fullscreen_control->set_activated_callback
(
[ctx]()
@ -965,7 +965,7 @@ void setup_controls(game_context* ctx)
);
// Create screenshot control
ctx->screenshot_control = new control();
ctx->screenshot_control = new input::control();
ctx->screenshot_control->set_activated_callback
(
[ctx]()
@ -976,22 +976,22 @@ void setup_controls(game_context* ctx)
);
// Create menu back control
ctx->menu_back_control = new control();
ctx->menu_back_control = new input::control();
ctx->menu_back_control->set_activated_callback
(
std::bind(&application::close, ctx->app, 0)
);
// Create menu select control
ctx->menu_select_control = new control();
ctx->menu_select_control = new input::control();
// Create application control set
ctx->application_controls = new control_set();
ctx->application_controls = new input::control_set();
ctx->application_controls->add_control(ctx->toggle_fullscreen_control);
ctx->application_controls->add_control(ctx->screenshot_control);
// Create menu control set
ctx->menu_controls = new control_set();
ctx->menu_controls = new input::control_set();
ctx->menu_controls->add_control(ctx->menu_back_control);
ctx->menu_controls->add_control(ctx->menu_select_control);
@ -1001,21 +1001,21 @@ void setup_controls(game_context* ctx)
ctx->camera_controls = ctx->control_system->get_control_set();
// Application control mappings
ctx->input_event_router->add_mapping(key_mapping(ctx->toggle_fullscreen_control, nullptr, scancode::f11));
ctx->input_event_router->add_mapping(key_mapping(ctx->screenshot_control, nullptr, scancode::f12));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->toggle_fullscreen_control, nullptr, input::scancode::f11));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->screenshot_control, nullptr, input::scancode::f12));
// Add menu control mappings
ctx->input_event_router->add_mapping(key_mapping(ctx->menu_back_control, nullptr, scancode::escape));
ctx->input_event_router->add_mapping(key_mapping(ctx->menu_back_control, nullptr, scancode::backspace));
ctx->input_event_router->add_mapping(game_controller_button_mapping(ctx->menu_back_control, nullptr, game_controller_button::b));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_tool_menu_control(), nullptr, scancode::left_shift));
ctx->input_event_router->add_mapping(game_controller_button_mapping(ctx->control_system->get_tool_menu_control(), nullptr, game_controller_button::x));
ctx->input_event_router->add_mapping(key_mapping(ctx->menu_select_control, nullptr, scancode::enter));
ctx->input_event_router->add_mapping(key_mapping(ctx->menu_select_control, nullptr, scancode::space));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_back_control, nullptr, input::scancode::escape));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_back_control, nullptr, input::scancode::backspace));
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->menu_back_control, nullptr, input::game_controller_button::b));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_tool_menu_control(), nullptr, input::scancode::left_shift));
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->control_system->get_tool_menu_control(), nullptr, input::game_controller_button::x));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_select_control, nullptr, input::scancode::enter));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->menu_select_control, nullptr, input::scancode::space));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_toggle_view_control(), nullptr, scancode::tab));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_toggle_view_control(), nullptr, input::scancode::tab));
ctx->control_system->get_toggle_view_control()->set_activated_callback(
[ctx]()
{
@ -1051,42 +1051,42 @@ void setup_controls(game_context* ctx)
}
});
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_move_forward_control(), nullptr, scancode::w));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_move_forward_control(), nullptr, game_controller_axis::left_y, true));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_move_back_control(), nullptr, scancode::s));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_move_back_control(), nullptr, game_controller_axis::left_y, false));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_move_left_control(), nullptr, scancode::a));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_move_left_control(), nullptr, game_controller_axis::left_x, true));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_move_right_control(), nullptr, scancode::d));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_move_right_control(), nullptr, game_controller_axis::left_x, false));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_rotate_ccw_control(), nullptr, game_controller_axis::right_x, false));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_rotate_cw_control(), nullptr, game_controller_axis::right_x, true));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_tilt_up_control(), nullptr, game_controller_axis::right_y, false));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_tilt_down_control(), nullptr, game_controller_axis::right_y, true));
ctx->input_event_router->add_mapping(mouse_wheel_mapping(ctx->control_system->get_zoom_in_control(), nullptr, mouse_wheel_axis::positive_y));
ctx->input_event_router->add_mapping(mouse_wheel_mapping(ctx->control_system->get_zoom_out_control(), nullptr, mouse_wheel_axis::negative_y));
ctx->input_event_router->add_mapping(mouse_button_mapping(ctx->control_system->get_adjust_camera_control(), nullptr, 3));
ctx->input_event_router->add_mapping(game_controller_button_mapping(ctx->control_system->get_ascend_control(), nullptr, game_controller_button::y));
ctx->input_event_router->add_mapping(game_controller_button_mapping(ctx->control_system->get_descend_control(), nullptr, game_controller_button::a));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_zoom_out_control(), nullptr, game_controller_axis::trigger_left, false));
ctx->input_event_router->add_mapping(game_controller_axis_mapping(ctx->control_system->get_zoom_in_control(), nullptr, game_controller_axis::trigger_right, false));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_rotate_ccw_control(), nullptr, scancode::q));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_rotate_cw_control(), nullptr, scancode::e));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_fast_forward_control(), nullptr, scancode::dot));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_rewind_control(), nullptr, scancode::comma));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_brush_control(), nullptr, scancode::one));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_twig_control(), nullptr, scancode::two));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_forceps_control(), nullptr, scancode::three));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_container_control(), nullptr, scancode::four));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_lens_control(), nullptr, scancode::five));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_marker_control(), nullptr, scancode::six));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_next_marker_control(), nullptr, scancode::right_brace));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_previous_marker_control(), nullptr, scancode::left_brace));
ctx->input_event_router->add_mapping(mouse_button_mapping(ctx->control_system->get_use_tool_control(), nullptr, 1));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_move_forward_control(), nullptr, input::scancode::w));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_move_forward_control(), nullptr, input::game_controller_axis::left_y, true));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_move_back_control(), nullptr, input::scancode::s));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_move_back_control(), nullptr, input::game_controller_axis::left_y, false));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_move_left_control(), nullptr, input::scancode::a));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_move_left_control(), nullptr, input::game_controller_axis::left_x, true));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_move_right_control(), nullptr, input::scancode::d));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_move_right_control(), nullptr, input::game_controller_axis::left_x, false));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_rotate_ccw_control(), nullptr, input::game_controller_axis::right_x, false));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_rotate_cw_control(), nullptr, input::game_controller_axis::right_x, true));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_tilt_up_control(), nullptr, input::game_controller_axis::right_y, false));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_tilt_down_control(), nullptr, input::game_controller_axis::right_y, true));
ctx->input_event_router->add_mapping(input::mouse_wheel_mapping(ctx->control_system->get_zoom_in_control(), nullptr, input::mouse_wheel_axis::positive_y));
ctx->input_event_router->add_mapping(input::mouse_wheel_mapping(ctx->control_system->get_zoom_out_control(), nullptr, input::mouse_wheel_axis::negative_y));
ctx->input_event_router->add_mapping(input::mouse_button_mapping(ctx->control_system->get_adjust_camera_control(), nullptr, 3));
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->control_system->get_ascend_control(), nullptr, input::game_controller_button::y));
ctx->input_event_router->add_mapping(input::game_controller_button_mapping(ctx->control_system->get_descend_control(), nullptr, input::game_controller_button::a));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_zoom_out_control(), nullptr, input::game_controller_axis::trigger_left, false));
ctx->input_event_router->add_mapping(input::game_controller_axis_mapping(ctx->control_system->get_zoom_in_control(), nullptr, input::game_controller_axis::trigger_right, false));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_rotate_ccw_control(), nullptr, input::scancode::q));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_rotate_cw_control(), nullptr, input::scancode::e));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_fast_forward_control(), nullptr, input::scancode::dot));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_rewind_control(), nullptr, input::scancode::comma));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_brush_control(), nullptr, input::scancode::one));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_twig_control(), nullptr, input::scancode::two));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_forceps_control(), nullptr, input::scancode::three));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_container_control(), nullptr, input::scancode::four));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_lens_control(), nullptr, input::scancode::five));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_equip_marker_control(), nullptr, input::scancode::six));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_next_marker_control(), nullptr, input::scancode::right_brace));
ctx->input_event_router->add_mapping(input::key_mapping(ctx->control_system->get_previous_marker_control(), nullptr, input::scancode::left_brace));
ctx->input_event_router->add_mapping(input::mouse_button_mapping(ctx->control_system->get_use_tool_control(), nullptr, 1));
ctx->control_system->get_use_tool_control()->set_activated_callback
(
[ctx]()

+ 15
- 15
src/game/game-context.hpp View File

@ -30,6 +30,11 @@
#include "gl/texture-2d.hpp"
#include "gl/rasterizer.hpp"
#include "gl/framebuffer.hpp"
#include "input/control.hpp"
#include "input/control-set.hpp"
#include "input/listener.hpp"
#include "input/mapper.hpp"
#include "input/event-router.hpp"
#include <optional>
#include <entt/entt.hpp>
#include <fstream>
@ -42,11 +47,8 @@ class bloom_pass;
class clear_pass;
class compositor;
class config_file;
class control;
class control_set;
class final_pass;
class material;
class input_listener;
class material_pass;
class orbit_cam;
class pheromone_matrix;
@ -57,8 +59,6 @@ class simple_render_pass;
class sky_pass;
class timeline;
class renderer;
class input_event_router;
class input_mapper;
class outline_pass;
struct biome;
@ -209,16 +209,16 @@ struct game_context
animation<float>* unequip_tool_animation;
// Controls
input_event_router* input_event_router;
input_mapper* input_mapper;
input_listener* input_listener;
control_set* application_controls;
control_set* camera_controls;
control_set* menu_controls;
control* menu_back_control;
control* menu_select_control;
control* screenshot_control;
control* toggle_fullscreen_control;
input::event_router* input_event_router;
input::mapper* input_mapper;
input::listener* input_listener;
input::control_set* application_controls;
input::control_set* camera_controls;
input::control_set* menu_controls;
input::control* menu_back_control;
input::control* menu_select_control;
input::control* screenshot_control;
input::control* toggle_fullscreen_control;
// Entities
ecs::registry* ecs_registry;

+ 1
- 1
src/game/states/map-state.cpp View File

@ -23,7 +23,7 @@
#include "application.hpp"
#include "debug/logger.hpp"
#include "game/game-context.hpp"
#include "input/input-listener.hpp"
#include "input/listener.hpp"
#include "event/input-events.hpp"
#include "gl/rasterizer.hpp"
#include "game/states/game-states.hpp"

+ 1
- 1
src/game/states/splash-state.cpp View File

@ -23,7 +23,7 @@
#include "application.hpp"
#include "debug/logger.hpp"
#include "game/game-context.hpp"
#include "input/input-listener.hpp"
#include "input/listener.hpp"
#include "event/input-events.hpp"
#include "gl/rasterizer.hpp"
#include "game/states/game-states.hpp"

+ 3
- 0
src/input/control-set.cpp View File

@ -20,6 +20,8 @@
#include "control-set.hpp"
#include "control.hpp"
namespace input {
void control_set::add_control(control* control)
{
controls.push_back(control);
@ -51,3 +53,4 @@ void control_set::set_callbacks_enabled(bool enabled)
}
}
} // namespace input

+ 7
- 3
src/input/control-set.hpp View File

@ -17,11 +17,13 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_CONTROL_SET_HPP
#define ANTKEEPER_CONTROL_SET_HPP
#ifndef ANTKEEPER_INPUT_CONTROL_SET_HPP
#define ANTKEEPER_INPUT_CONTROL_SET_HPP
#include <list>
namespace input {
class control;
/**
@ -77,5 +79,7 @@ inline const std::list* control_set::get_controls() const
return &controls;
}
#endif // ANTKEEPER_CONTROL_SET_HPP
} // namespace input
#endif // ANTKEEPER_INPUT_CONTROL_SET_HPP

+ 3
- 0
src/input/control.cpp View File

@ -19,6 +19,8 @@
#include "control.hpp"
namespace input {
control::control():
deadzone(0.0f),
current_value(0.0f),
@ -109,3 +111,4 @@ void control::set_value_changed_callback(std::function callback)
this->value_changed_callback = callback;
}
} // namespace input

+ 7
- 5
src/input/control.hpp View File

@ -17,15 +17,15 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_CONTROL_HPP
#define ANTKEEPER_CONTROL_HPP
#ifndef ANTKEEPER_INPUT_CONTROL_HPP
#define ANTKEEPER_INPUT_CONTROL_HPP
#include <functional>
namespace input {
/**
* A control can be bound to multiple types of input events.
*
* @ingroup input
*/
class control
{
@ -132,5 +132,7 @@ inline bool control::was_active() const
return previous_value > deadzone;
}
#endif // ANTKEEPER_CONTROL_HPP
} // namespace input
#endif // ANTKEEPER_INPUT_CONTROL_HPP

src/input/input-device.cpp → src/input/device.cpp View File

@ -17,14 +17,17 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "input-device.hpp"
#include "event/event-dispatcher.hpp"
#include "device.hpp"
input_device::input_device():
namespace input {
device::device():
event_dispatcher(nullptr)
{}
void input_device::set_event_dispatcher(::event_dispatcher* event_dispatcher)
void device::set_event_dispatcher(::event_dispatcher* event_dispatcher)
{
this->event_dispatcher = event_dispatcher;
}
} // namespace input

src/input/input-device.hpp → src/input/device.hpp View File

@ -20,18 +20,18 @@
#ifndef ANTKEEPER_INPUT_DEVICE_HPP
#define ANTKEEPER_INPUT_DEVICE_HPP
#include "input-device.hpp"
#include "event/event-dispatcher.hpp"
class event_dispatcher;
namespace input {
/**
* Base class for virtual devices which generate input events.
*/
class input_device
class device
{
public:
input_device();
virtual ~input_device() = default;
device();
virtual ~device() = default;
void set_event_dispatcher(event_dispatcher* event_dispatcher);
const event_dispatcher* get_event_dispatcher() const;
@ -41,15 +41,17 @@ protected:
event_dispatcher* event_dispatcher;
};
inline const event_dispatcher* input_device::get_event_dispatcher() const
inline const event_dispatcher* device::get_event_dispatcher() const
{
return event_dispatcher;
}
inline event_dispatcher* input_device::get_event_dispatcher()
inline event_dispatcher* device::get_event_dispatcher()
{
return event_dispatcher;
}
} // namespace input
#endif // ANTKEEPER_INPUT_DEVICE_HPP

src/input/input-event-router.cpp → src/input/event-router.cpp View File

@ -17,76 +17,78 @@
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "input-event-router.hpp"
#include "event-router.hpp"
#include "control.hpp"
#include "input-mapping.hpp"
#include "mapping.hpp"
#include "mouse.hpp"
#include "event/event-dispatcher.hpp"
input_event_router::input_event_router():
namespace input {
event_router::event_router():
event_dispatcher(nullptr)
{}
input_event_router::~input_event_router()
event_router::~event_router()
{
remove_mappings();
set_event_dispatcher(nullptr);
}
void input_event_router::add_mapping(const input_mapping& mapping)
void event_router::add_mapping(const mapping& mapping)
{
control* control = mapping.control;
switch (mapping.get_type())
{
case input_mapping_type::key:
case mapping_type::key:
{
::key_mapping* key_mapping = new ::key_mapping(static_cast<const ::key_mapping&>(mapping));
input::key_mapping* key_mapping = new input::key_mapping(static_cast<const input::key_mapping&>(mapping));
key_mappings.push_back(key_mapping);
controls[control].push_back(key_mapping);
break;
}
case input_mapping_type::mouse_motion:
case mapping_type::mouse_motion:
{
::mouse_motion_mapping* mouse_motion_mapping = new ::mouse_motion_mapping(static_cast<const ::mouse_motion_mapping&>(mapping));
input::mouse_motion_mapping* mouse_motion_mapping = new input::mouse_motion_mapping(static_cast<const input::mouse_motion_mapping&>(mapping));
mouse_motion_mappings.push_back(mouse_motion_mapping);
controls[control].push_back(mouse_motion_mapping);
break;
}
case input_mapping_type::mouse_wheel:
case mapping_type::mouse_wheel:
{
::mouse_wheel_mapping* mouse_wheel_mapping = new ::mouse_wheel_mapping(static_cast<const ::mouse_wheel_mapping&>(mapping));
input::mouse_wheel_mapping* mouse_wheel_mapping = new input::mouse_wheel_mapping(static_cast<const input::mouse_wheel_mapping&>(mapping));
mouse_wheel_mappings.push_back(mouse_wheel_mapping);
controls[control].push_back(mouse_wheel_mapping);
break;
}
case input_mapping_type::mouse_button:
case mapping_type::mouse_button:
{
::mouse_button_mapping* mouse_button_mapping = new ::mouse_button_mapping(static_cast<const ::mouse_button_mapping&>(mapping));
input::mouse_button_mapping* mouse_button_mapping = new input::mouse_button_mapping(static_cast<const input::mouse_button_mapping&>(mapping));
mouse_button_mappings.push_back(mouse_button_mapping);
controls[control].push_back(mouse_button_mapping);
break;
}
case input_mapping_type::game_controller_axis:
case mapping_type::game_controller_axis:
{
::game_controller_axis_mapping* game_controller_axis_mapping = new ::game_controller_axis_mapping(static_cast<const ::game_controller_axis_mapping&>(mapping));
input::game_controller_axis_mapping* game_controller_axis_mapping = new input::game_controller_axis_mapping(static_cast<const input::game_controller_axis_mapping&>(mapping));
game_controller_axis_mappings.push_back(game_controller_axis_mapping);
controls[control].push_back(game_controller_axis_mapping);
break;
}
case input_mapping_type::game_controller_button:
case mapping_type::game_controller_button:
{
::game_controller_button_mapping* game_controller_button_mapping = new ::game_controller_button_mapping(static_cast<const ::game_controller_button_mapping&>(mapping));
input::game_controller_button_mapping* game_controller_button_mapping = new input::game_controller_button_mapping(static_cast<const input::game_controller_button_mapping&>(mapping));
game_controller_button_mappings.push_back(game_controller_button_mapping);
controls[control].push_back(game_controller_button_mapping);
@ -98,36 +100,36 @@ void input_event_router::add_mapping(const input_mapping& mapping)
}
}
void input_event_router::remove_mappings(control* control)
void event_router::remove_mappings(control* control)
{
auto it = controls.find(control);
if (it != controls.end())
{
for (input_mapping* mapping: it->second)
for (mapping* mapping: it->second)
{
switch (mapping->get_type())
{
case input_mapping_type::key:
case mapping_type::key:
key_mappings.remove(static_cast<key_mapping*>(mapping));
break;
case input_mapping_type::mouse_motion:
case mapping_type::mouse_motion:
mouse_motion_mappings.remove(static_cast<mouse_motion_mapping*>(mapping));
break;
case input_mapping_type::mouse_wheel:
case mapping_type::mouse_wheel:
mouse_wheel_mappings.remove(static_cast<mouse_wheel_mapping*>(mapping));
break;
case input_mapping_type::mouse_button:
case mapping_type::mouse_button:
mouse_button_mappings.remove(static_cast<mouse_button_mapping*>(mapping));
break;
case input_mapping_type::game_controller_axis:
case mapping_type::game_controller_axis:
game_controller_axis_mappings.remove(static_cast<game_controller_axis_mapping*>(mapping));
break;
case input_mapping_type::game_controller_button:
case mapping_type::game_controller_button:
game_controller_button_mappings.remove(static_cast<game_controller_button_mapping*>(mapping));
break;
@ -142,7 +144,7 @@ void input_event_router::remove_mappings(control* control)
}
}
void input_event_router::set_event_dispatcher(::event_dispatcher* event_dispatcher)
void event_router::set_event_dispatcher(::event_dispatcher* event_dispatcher)
{
if (this->event_dispatcher)
{
@ -173,11 +175,11 @@ void input_event_router::set_event_dispatcher(::event_dispatcher* event_dispatch
}
}
void input_event_router::remove_mappings()
void event_router::remove_mappings()
{
for (auto it = controls.begin(); it != controls.end(); ++it)
{
for (input_mapping* mapping: it->second)
for (mapping* mapping: it->second)
{
delete mapping;
}
@ -192,7 +194,7 @@ void input_event_router::remove_mappings()
game_controller_button_mappings.clear();
}
const std::list<input_mapping*>* input_event_router::get_mappings(control* control) const
const std::list<mapping*>* event_router::get_mappings(control* control) const
{
auto it = controls.find(control);
if (it == controls.end())
@ -203,7 +205,7 @@ const std::list* input_event_router::get_mappings(control* contr
return &it->second;
}
void input_event_router::handle_event(const key_pressed_event& event)
void event_router::handle_event(const key_pressed_event& event)
{
for (const key_mapping* mapping: key_mappings)
{
@ -214,7 +216,7 @@ void input_event_router::handle_event(const key_pressed_event& event)
}
}
void input_event_router::handle_event(const key_released_event& event)
void event_router::handle_event(const key_released_event& event)
{
for (const key_mapping* mapping: key_mappings)
{
@ -225,7 +227,7 @@ void input_event_router::handle_event(const key_released_event& event)
}
}
void input_event_router::handle_event(const mouse_moved_event& event)
void event_router::handle_event(const mouse_moved_event& event)
{
for (const mouse_motion_mapping* mapping: mouse_motion_mappings)
{
@ -251,7 +253,7 @@ void input_event_router::handle_event(const mouse_moved_event& event)
}
}
void input_event_router::handle_event(const mouse_wheel_scrolled_event& event)
void event_router::handle_event(const mouse_wheel_scrolled_event& event)
{
for (const mouse_wheel_mapping* mapping: mouse_wheel_mappings)
{
@ -277,7 +279,7 @@ void input_event_router::handle_event(const mouse_wheel_scrolled_event& event)
}
}
void input_event_router::handle_event(const mouse_button_pressed_event& event)
void event_router::handle_event(const mouse_button_pressed_event& event)
{
for (const mouse_button_mapping* mapping: mouse_button_mappings)
{
@ -288,7 +290,7 @@ void input_event_router::handle_event(const mouse_button_pressed_event& event)
}
}
void input_event_router::handle_event(const mouse_button_released_event& event)
void event_router::handle_event(const mouse_button_released_event& event)
{
for (const mouse_button_mapping* mapping: mouse_button_mappings)
{
@ -299,11 +301,11 @@ void input_event_router::handle_event(const mouse_button_released_event& event)
}
}
void input_event_router::handle_event(const game_controller_axis_moved_event& event)
void event_router::handle_event(const game_controller_axis_moved_event& event)
{