INPUT_USE_* → enum class Input::Device

This commit is contained in:
2026-05-16 19:54:52 +02:00
parent d72630523a
commit 40e1140734
8 changed files with 42 additions and 39 deletions
+7 -7
View File
@@ -7,7 +7,7 @@
#include <iostream>
#include <string>
#include "core/input/input.h" // for INPUT_USE_KEYBOARD, INPUT_USE_GAMECONTROLLER
#include "core/input/input.h" // for Input::Device::KEYBOARD, Input::Device::GAMECONTROLLER
#include "core/locale/lang.h" // for Lang::Code, Lang::MAX_LANGUAGES
#include "external/fkyaml_node.hpp" // for fkyaml::node
#include "utils/utils.h" // for boolToString
@@ -163,9 +163,9 @@ namespace Options {
size_t i = 0;
for (const auto &entry : ins) {
if (i >= inputs.size()) { break; }
int device_type_int = inputs[i].device_type;
int device_type_int = static_cast<int>(inputs[i].device_type);
if (tryGet<int>(entry, "device_type", device_type_int)) {
inputs[i].device_type = static_cast<Uint8>(device_type_int);
inputs[i].device_type = static_cast<Input::Device>(device_type_int);
}
++i;
}
@@ -202,13 +202,13 @@ namespace Options {
InputDevice kb;
kb.id = 0;
kb.name = "KEYBOARD";
kb.device_type = INPUT_USE_KEYBOARD;
kb.device_type = Input::Device::KEYBOARD;
inputs.push_back(kb);
InputDevice gc;
gc.id = 0;
gc.name = "GAME CONTROLLER";
gc.device_type = INPUT_USE_GAMECONTROLLER;
gc.device_type = Input::Device::GAMECONTROLLER;
inputs.push_back(gc);
}
@@ -325,8 +325,8 @@ namespace Options {
// INPUT
file << "# INPUT DEVICES (device_type: "
<< static_cast<int>(INPUT_USE_KEYBOARD) << "=KEYBOARD, "
<< static_cast<int>(INPUT_USE_GAMECONTROLLER) << "=GAMECONTROLLER)\n";
<< static_cast<int>(Input::Device::KEYBOARD) << "=KEYBOARD, "
<< static_cast<int>(Input::Device::GAMECONTROLLER) << "=GAMECONTROLLER)\n";
file << "input:\n";
for (size_t i = 0; i < inputs.size(); ++i) {
file << " - slot: " << i << "\n";