migrant input: commit abans que gemini destroçe algo

This commit is contained in:
2025-08-04 11:37:46 +02:00
parent 90c080f3e3
commit 050b6716bf
10 changed files with 245 additions and 99 deletions

View File

@@ -12,11 +12,12 @@
// Constructor
DefineButtons::DefineButtons()
: input_(Input::get()) {
// Inicializa variables
x_ = param.game.width / 2;
y_ = param.title.press_start_position;
: input_(Input::get()),
enabled_(false),
finished_(false),
x_(param.game.width / 2),
y_(param.title.press_start_position),
index_button_(0) {
clearButtons();
auto gamepads = input_->getGamepads();
@@ -29,8 +30,8 @@ DefineButtons::DefineButtons()
void DefineButtons::render() {
static auto text = Resource::get()->getText("8bithud");
if (enabled_) {
text->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(static_cast<int>(gamepad_options_->player_id)));
text->writeCentered(x_, y_, gamepad_options_->instance->name);
text->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(static_cast<int>(gamepad_->player_id)));
text->writeCentered(x_, y_, gamepad_->name);
text->writeCentered(x_, y_ + 10, buttons_.at(index_button_).label);
}
}
@@ -77,9 +78,9 @@ void DefineButtons::checkEvents(const SDL_Event &event) {
}
// Habilita el objeto
auto DefineButtons::enable(std::shared_ptr<Options::Gamepad> gamepad_options) -> bool {
if (gamepad_options != nullptr) {
gamepad_options_ = gamepad_options;
auto DefineButtons::enable(Options::Gamepad *gamepad) -> bool {
if (gamepad != nullptr) {
gamepad_ = gamepad;
enabled_ = true;
finished_ = false;
index_button_ = 0;