This commit is contained in:
2024-10-23 22:18:46 +02:00
parent 6e2f80d8ce
commit 8c98430b68
2 changed files with 20 additions and 43 deletions

View File

@@ -10,49 +10,22 @@
// Constructor
DefineButtons::DefineButtons(std::unique_ptr<Text> text_)
: text_(std::move(text_))
: input_(Input::get()),
text_(std::move(text_))
{
// Copia punteros a los objetos
input_ = Input::get();
// Inicializa variables
enabled_ = false;
x_ = param.game.width / 2;
y_ = param.title.press_start_position;
index_controller_ = 0;
index_button_ = 0;
buttons_.clear();
DefineButtonsButton button;
button.label = lang::getText(95);
button.input = InputType::FIRE_LEFT;
button.button = SDL_CONTROLLER_BUTTON_X;
buttons_.push_back(button);
button.label = lang::getText(96);
button.input = InputType::FIRE_CENTER;
button.button = SDL_CONTROLLER_BUTTON_Y;
buttons_.push_back(button);
button.label = lang::getText(97);
button.input = InputType::FIRE_RIGHT;
button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
buttons_.push_back(button);
button.label = lang::getText(98);
button.input = InputType::START;
button.button = SDL_CONTROLLER_BUTTON_START;
buttons_.push_back(button);
button.label = lang::getText(99);
button.input = InputType::EXIT;
button.button = SDL_CONTROLLER_BUTTON_BACK;
buttons_.push_back(button);
buttons_.emplace_back(lang::getText(95), InputType::FIRE_LEFT, SDL_CONTROLLER_BUTTON_X);
buttons_.emplace_back(lang::getText(96), InputType::FIRE_CENTER, SDL_CONTROLLER_BUTTON_Y);
buttons_.emplace_back(lang::getText(97), InputType::FIRE_RIGHT, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
buttons_.emplace_back(lang::getText(98), InputType::START, SDL_CONTROLLER_BUTTON_START);
buttons_.emplace_back(lang::getText(99), InputType::EXIT, SDL_CONTROLLER_BUTTON_BACK);
for (int i = 0; i < input_->getNumControllers(); ++i)
{
controller_names_.push_back(input_->getControllerName(i));
controller_names_.emplace_back(input_->getControllerName(i));
}
}