@@ -14,38 +14,38 @@ input::KeyboardInput::KeyboardInput() : input::Input{ "keyboard", InputType::Key
1414
1515 if (event.type == SDL_KEYDOWN) {
1616
17- const auto key = SDL ::Key{ event.key .keysym };
17+ const auto key = sdl ::Key{ event.key .keysym };
1818
19- if (key == SDL ::Key{ SDLK_RETURN } or key == SDL ::Key{ SDLK_SPACE }) {
19+ if (key == sdl ::Key{ SDLK_RETURN } or key == sdl ::Key{ SDLK_SPACE }) {
2020 return NavigationEvent::OK;
2121 }
2222
23- if (key == SDL ::Key{ SDLK_DOWN } or key == SDL ::Key{ SDLK_s }) {
23+ if (key == sdl ::Key{ SDLK_DOWN } or key == sdl ::Key{ SDLK_s }) {
2424 return NavigationEvent::DOWN;
2525 }
2626
2727
28- if (key == SDL ::Key{ SDLK_UP } or key == SDL ::Key{ SDLK_w }) {
28+ if (key == sdl ::Key{ SDLK_UP } or key == sdl ::Key{ SDLK_w }) {
2929 return NavigationEvent::UP;
3030 }
3131
3232
33- if (key == SDL ::Key{ SDLK_LEFT } or key == SDL ::Key{ SDLK_a }) {
33+ if (key == sdl ::Key{ SDLK_LEFT } or key == sdl ::Key{ SDLK_a }) {
3434 return NavigationEvent::LEFT;
3535 }
3636
3737
38- if (key == SDL ::Key{ SDLK_RIGHT } or key == SDL ::Key{ SDLK_d }) {
38+ if (key == sdl ::Key{ SDLK_RIGHT } or key == sdl ::Key{ SDLK_d }) {
3939 return NavigationEvent::RIGHT;
4040 }
4141
4242
43- if (key == SDL ::Key{ SDLK_ESCAPE } or key == SDL ::Key{ SDLK_BACKSPACE }) {
43+ if (key == sdl ::Key{ SDLK_ESCAPE } or key == sdl ::Key{ SDLK_BACKSPACE }) {
4444 return NavigationEvent::BACK;
4545 }
4646
4747
48- if (key == SDL ::Key{ SDLK_TAB }) {
48+ if (key == sdl ::Key{ SDLK_TAB }) {
4949 return NavigationEvent::TAB;
5050 }
5151 }
@@ -60,19 +60,19 @@ input::KeyboardInput::KeyboardInput() : input::Input{ "keyboard", InputType::Key
6060 switch (event) {
6161
6262 case NavigationEvent::OK:
63- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_RETURN }, SDL ::Key{ SDLK_SPACE });
63+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_RETURN }, sdl ::Key{ SDLK_SPACE });
6464 case NavigationEvent::DOWN:
65- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_DOWN }, SDL ::Key{ SDLK_s });
65+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_DOWN }, sdl ::Key{ SDLK_s });
6666 case NavigationEvent::UP:
67- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_UP }, SDL ::Key{ SDLK_w });
67+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_UP }, sdl ::Key{ SDLK_w });
6868 case NavigationEvent::LEFT:
69- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_LEFT }, SDL ::Key{ SDLK_a });
69+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_LEFT }, sdl ::Key{ SDLK_a });
7070 case NavigationEvent::RIGHT:
71- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_RIGHT }, SDL ::Key{ SDLK_d });
71+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_RIGHT }, sdl ::Key{ SDLK_d });
7272 case NavigationEvent::BACK:
73- return fmt::format (" {} or {}" , SDL ::Key{ SDLK_ESCAPE }, SDL ::Key{ SDLK_BACKSPACE });
73+ return fmt::format (" {} or {}" , sdl ::Key{ SDLK_ESCAPE }, sdl ::Key{ SDLK_BACKSPACE });
7474 case NavigationEvent::TAB:
75- return fmt::format (" {}" , SDL ::Key{ SDLK_TAB });
75+ return fmt::format (" {}" , sdl ::Key{ SDLK_TAB });
7676 default :
7777 utils::unreachable ();
7878 }
@@ -97,7 +97,7 @@ void input::KeyboardGameInput::update(SimulationStep simulation_step_index) {
9797
9898helper::optional<InputEvent> input::KeyboardGameInput::sdl_event_to_input_event (const SDL_Event& event) const {
9999 if (event.type == SDL_KEYDOWN and event.key .repeat == 0 ) {
100- const auto key = SDL ::Key{ event.key .keysym };
100+ const auto key = sdl ::Key{ event.key .keysym };
101101 if (key == m_settings.rotate_left ) {
102102 return InputEvent::RotateLeftPressed;
103103 }
@@ -120,7 +120,7 @@ helper::optional<InputEvent> input::KeyboardGameInput::sdl_event_to_input_event(
120120 return InputEvent::HoldPressed;
121121 }
122122 } else if (event.type == SDL_KEYUP) {
123- const auto key = SDL ::Key{ event.key .keysym };
123+ const auto key = sdl ::Key{ event.key .keysym };
124124 if (key == m_settings.rotate_left ) {
125125 return InputEvent::RotateLeftReleased;
126126 }
@@ -160,20 +160,20 @@ input::KeyboardGameInput::~KeyboardGameInput() {
160160
161161[[nodiscard]] helper::expected<bool , std::string> input::KeyboardSettings::validate () const {
162162
163- const std::vector<SDL ::Key> to_use{ rotate_left, rotate_right, move_left, move_right, move_down,
163+ const std::vector<sdl ::Key> to_use{ rotate_left, rotate_right, move_left, move_right, move_down,
164164 drop, hold, pause, open_settings };
165165
166166 return input::InputSettings::has_unique_members (to_use);
167167}
168168
169- SDL ::Key json_helper::get_key (const nlohmann::json& j, const std::string& name) {
169+ sdl ::Key json_helper::get_key (const nlohmann::json& j, const std::string& name) {
170170
171171 auto context = j.at (name);
172172
173173 std::string input;
174174 context.get_to (input);
175175
176- const auto & value = SDL ::Key::from_string (input);
176+ const auto & value = sdl ::Key::from_string (input);
177177
178178 if (not value.has_value ()) {
179179 throw nlohmann::json::type_error::create (
@@ -189,7 +189,7 @@ SDL::Key json_helper::get_key(const nlohmann::json& j, const std::string& name)
189189) const {
190190
191191 if (event.type == SDL_KEYDOWN and event.key .repeat == 0 ) {
192- const auto key = SDL ::Key{ event.key .keysym };
192+ const auto key = sdl ::Key{ event.key .keysym };
193193 if (key == m_settings.pause ) {
194194 return MenuEvent::Pause;
195195 }
0 commit comments