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
+11 -11
View File
@@ -8,7 +8,7 @@
#include "core/audio/audio.hpp" // for Audio
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
#include "core/input/input.h" // for Input, INPUT_USE_GAMECONTROLLER, INPUT_...
#include "core/input/input.h" // for Input, Input::Device::GAMECONTROLLER, INPUT_...
#include "core/locale/lang.h" // for Lang, Lang::Code
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "core/rendering/fade.h" // for Fade
@@ -115,12 +115,12 @@ void Title::init() {
InputDevice inp;
inp.id = 0;
inp.name = "KEYBOARD";
inp.device_type = INPUT_USE_KEYBOARD;
inp.device_type = Input::Device::KEYBOARD;
Options::inputs.push_back(inp);
inp.id = 0;
inp.name = "GAME CONTROLLER";
inp.device_type = INPUT_USE_GAMECONTROLLER;
inp.device_type = Input::Device::GAMECONTROLLER;
Options::inputs.push_back(inp);
// Comprueba si hay mandos conectados
@@ -676,12 +676,12 @@ void Title::updateMenuLabels() const {
i++;
// PLAYER 1 CONTROLS - OPTIONS
switch (Options::inputs[0].device_type) {
case INPUT_USE_KEYBOARD:
case Input::Device::KEYBOARD:
menu_.options->setItemCaption(i, Lang::get()->getText(69)); // KEYBOARD
menu_.options->setGreyed(i, false);
break;
case INPUT_USE_GAMECONTROLLER:
case Input::Device::GAMECONTROLLER:
menu_.options->setItemCaption(i, Lang::get()->getText(70)); // GAME CONTROLLER
if (!Input::get()->gameControllerFound()) {
menu_.options->setGreyed(i, true);
@@ -703,12 +703,12 @@ void Title::updateMenuLabels() const {
i++;
// PLAYER 2 CONTROLS - OPTIONS
switch (Options::inputs[1].device_type) {
case INPUT_USE_KEYBOARD:
case Input::Device::KEYBOARD:
menu_.options->setItemCaption(i, Lang::get()->getText(69)); // KEYBOARD
menu_.options->setGreyed(i, false);
break;
case INPUT_USE_GAMECONTROLLER:
case Input::Device::GAMECONTROLLER:
menu_.options->setItemCaption(i, Lang::get()->getText(70)); // GAME CONTROLLER
if (!Input::get()->gameControllerFound()) {
menu_.options->setGreyed(i, true);
@@ -963,11 +963,11 @@ auto Title::updatePlayerInputs(int num_player) -> bool {
Options::inputs[0].id = -1;
Options::inputs[0].name = "KEYBOARD";
Options::inputs[0].device_type = INPUT_USE_KEYBOARD;
Options::inputs[0].device_type = Input::Device::KEYBOARD;
Options::inputs[1].id = 0;
Options::inputs[1].name = "GAME CONTROLLER";
Options::inputs[1].device_type = INPUT_USE_GAMECONTROLLER;
Options::inputs[1].device_type = Input::Device::GAMECONTROLLER;
return true;
} // Si hay mas de un dispositivo, se recorre el vector
@@ -1059,7 +1059,7 @@ void Title::checkInputDevices() {
for (int i = 0; i < NUM_CONTROLLERS; ++i) {
temp.id = i;
temp.name = Input::get()->getControllerName(i);
temp.device_type = INPUT_USE_GAMECONTROLLER;
temp.device_type = Input::Device::GAMECONTROLLER;
available_input_devices_.push_back(temp);
if (Options::settings.console) {
std::cout << "Device " << (int)available_input_devices_.size() << " - " << temp.name.c_str() << '\n';
@@ -1070,7 +1070,7 @@ void Title::checkInputDevices() {
// Añade el teclado al final
temp.id = -1;
temp.name = "KEYBOARD";
temp.device_type = INPUT_USE_KEYBOARD;
temp.device_type = Input::Device::KEYBOARD;
available_input_devices_.push_back(temp);
if (Options::settings.console) {
std::cout << "Device " << (int)available_input_devices_.size() << " - " << temp.name.c_str() << '\n';