💿🐜 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.

141 lines
3.8 KiB

  1. /*
  2. * Copyright (C) 2020 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 "input-mapping.hpp"
  20. input_mapping::input_mapping(::control* control):
  21. control(control)
  22. {}
  23. key_mapping::key_mapping(const key_mapping& mapping)
  24. {
  25. *this = mapping;
  26. }
  27. key_mapping::key_mapping(::control* control, ::keyboard* keyboard, ::scancode scancode):
  28. input_mapping(control),
  29. keyboard(keyboard),
  30. scancode(scancode)
  31. {}
  32. key_mapping& key_mapping::operator=(const key_mapping& mapping)
  33. {
  34. control = mapping.control;
  35. keyboard = mapping.keyboard;
  36. scancode = mapping.scancode;
  37. return *this;
  38. }
  39. mouse_motion_mapping::mouse_motion_mapping(const mouse_motion_mapping& mapping)
  40. {
  41. *this = mapping;
  42. }
  43. mouse_motion_mapping::mouse_motion_mapping(::control* control, ::mouse* mouse, mouse_motion_axis axis):
  44. input_mapping(control),
  45. mouse(mouse),
  46. axis(axis)
  47. {}
  48. mouse_motion_mapping& mouse_motion_mapping::operator=(const mouse_motion_mapping& mapping)
  49. {
  50. control = mapping.control;
  51. mouse = mapping.mouse;
  52. axis = mapping.axis;
  53. return *this;
  54. }
  55. mouse_wheel_mapping::mouse_wheel_mapping(const mouse_wheel_mapping& mapping)
  56. {
  57. *this = mapping;
  58. }
  59. mouse_wheel_mapping::mouse_wheel_mapping(::control* control, ::mouse* mouse, ::mouse_wheel_axis axis):
  60. input_mapping(control),
  61. mouse(mouse),
  62. axis(axis)
  63. {}
  64. mouse_wheel_mapping& mouse_wheel_mapping::operator=(const mouse_wheel_mapping& mapping)
  65. {
  66. control = mapping.control;
  67. mouse = mapping.mouse;
  68. axis = mapping.axis;
  69. return *this;
  70. }
  71. mouse_button_mapping::mouse_button_mapping(const mouse_button_mapping& mapping)
  72. {
  73. *this = mapping;
  74. }
  75. mouse_button_mapping::mouse_button_mapping(::control* control, ::mouse* mouse, int button):
  76. input_mapping(control),
  77. mouse(mouse),
  78. button(button)
  79. {}
  80. mouse_button_mapping& mouse_button_mapping::operator=(const mouse_button_mapping& mapping)
  81. {
  82. control = mapping.control;
  83. mouse = mapping.mouse;
  84. button = mapping.button;
  85. return *this;
  86. }
  87. game_controller_axis_mapping::game_controller_axis_mapping(const game_controller_axis_mapping& mapping)
  88. {
  89. *this = mapping;
  90. }
  91. game_controller_axis_mapping::game_controller_axis_mapping(::control* control, ::game_controller* game_controller, game_controller_axis axis, bool negative):
  92. input_mapping(control),
  93. game_controller(game_controller),
  94. axis(axis),
  95. negative(negative)
  96. {}
  97. game_controller_axis_mapping& game_controller_axis_mapping::operator=(const game_controller_axis_mapping& mapping)
  98. {
  99. control = mapping.control;
  100. game_controller = mapping.game_controller;
  101. axis = mapping.axis;
  102. negative = mapping.negative;
  103. return *this;
  104. }
  105. game_controller_button_mapping::game_controller_button_mapping(const game_controller_button_mapping& mapping)
  106. {
  107. *this = mapping;
  108. }
  109. game_controller_button_mapping::game_controller_button_mapping(::control* control, ::game_controller* game_controller, game_controller_button button):
  110. input_mapping(control),
  111. game_controller(game_controller),
  112. button(button)
  113. {}
  114. game_controller_button_mapping& game_controller_button_mapping::operator=(const game_controller_button_mapping& mapping)
  115. {
  116. control = mapping.control;
  117. game_controller = mapping.game_controller;
  118. button = mapping.button;
  119. return *this;
  120. }