💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.8 KiB

  1. /*
  2. * Copyright (C) 2021 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include "mapping.hpp"
  20. namespace input {
  21. mapping::mapping(input::control* control):
  22. control(control)
  23. {}
  24. key_mapping::key_mapping(const key_mapping& mapping)
  25. {
  26. *this = mapping;
  27. }
  28. key_mapping::key_mapping(input::control* control, input::keyboard* keyboard, input::scancode scancode):
  29. mapping(control),
  30. keyboard(keyboard),
  31. scancode(scancode)
  32. {}
  33. key_mapping& key_mapping::operator=(const key_mapping& mapping)
  34. {
  35. control = mapping.control;
  36. keyboard = mapping.keyboard;
  37. scancode = mapping.scancode;
  38. return *this;
  39. }
  40. mouse_motion_mapping::mouse_motion_mapping(const mouse_motion_mapping& mapping)
  41. {
  42. *this = mapping;
  43. }
  44. mouse_motion_mapping::mouse_motion_mapping(input::control* control, input::mouse* mouse, mouse_motion_axis axis):
  45. mapping(control),
  46. mouse(mouse),
  47. axis(axis)
  48. {}
  49. mouse_motion_mapping& mouse_motion_mapping::operator=(const mouse_motion_mapping& mapping)
  50. {
  51. control = mapping.control;
  52. mouse = mapping.mouse;
  53. axis = mapping.axis;
  54. return *this;
  55. }
  56. mouse_wheel_mapping::mouse_wheel_mapping(const mouse_wheel_mapping& mapping)
  57. {
  58. *this = mapping;
  59. }
  60. mouse_wheel_mapping::mouse_wheel_mapping(input::control* control, input::mouse* mouse, mouse_wheel_axis axis):
  61. mapping(control),
  62. mouse(mouse),
  63. axis(axis)
  64. {}
  65. mouse_wheel_mapping& mouse_wheel_mapping::operator=(const mouse_wheel_mapping& mapping)
  66. {
  67. control = mapping.control;
  68. mouse = mapping.mouse;
  69. axis = mapping.axis;
  70. return *this;
  71. }
  72. mouse_button_mapping::mouse_button_mapping(const mouse_button_mapping& mapping)
  73. {
  74. *this = mapping;
  75. }
  76. mouse_button_mapping::mouse_button_mapping(input::control* control, input::mouse* mouse, int button):
  77. mapping(control),
  78. mouse(mouse),
  79. button(button)
  80. {}
  81. mouse_button_mapping& mouse_button_mapping::operator=(const mouse_button_mapping& mapping)
  82. {
  83. control = mapping.control;
  84. mouse = mapping.mouse;
  85. button = mapping.button;
  86. return *this;
  87. }
  88. game_controller_axis_mapping::game_controller_axis_mapping(const game_controller_axis_mapping& mapping)
  89. {
  90. *this = mapping;
  91. }
  92. game_controller_axis_mapping::game_controller_axis_mapping(input::control* control, game_controller* controller, game_controller_axis axis, bool negative):
  93. mapping(control),
  94. controller(controller),
  95. axis(axis),
  96. negative(negative)
  97. {}
  98. game_controller_axis_mapping& game_controller_axis_mapping::operator=(const game_controller_axis_mapping& mapping)
  99. {
  100. control = mapping.control;
  101. controller = mapping.controller;
  102. axis = mapping.axis;
  103. negative = mapping.negative;
  104. return *this;
  105. }
  106. game_controller_button_mapping::game_controller_button_mapping(const game_controller_button_mapping& mapping)
  107. {
  108. *this = mapping;
  109. }
  110. game_controller_button_mapping::game_controller_button_mapping(input::control* control, game_controller* controller, game_controller_button button):
  111. mapping(control),
  112. controller(controller),
  113. button(button)
  114. {}
  115. game_controller_button_mapping& game_controller_button_mapping::operator=(const game_controller_button_mapping& mapping)
  116. {
  117. control = mapping.control;
  118. controller = mapping.controller;
  119. button = mapping.button;
  120. return *this;
  121. }
  122. } // namespace input