renombrades extensions .h a .hpp
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
#include "define_buttons.h"
|
||||
#include "define_buttons.hpp"
|
||||
|
||||
#include <algorithm> // Para __all_of_fn, all_of
|
||||
#include <functional> // Para identity
|
||||
#include <memory> // Para allocator, unique_ptr, shared_ptr, make_unique, operator==
|
||||
|
||||
#include "color.h" // Para Color
|
||||
#include "input.h" // Para Input
|
||||
#include "input_types.h" // Para InputAction
|
||||
#include "lang.h" // Para getText
|
||||
#include "options.h" // Para Gamepad
|
||||
#include "param.h" // Para Param, ParamGame, param
|
||||
#include "resource.h" // Para Resource
|
||||
#include "ui/window_message.h" // Para WindowMessage
|
||||
#include "utils.h" // Para Zone
|
||||
#include "color.hpp" // Para Color
|
||||
#include "input.hpp" // Para Input
|
||||
#include "input_types.hpp" // Para InputAction
|
||||
#include "lang.hpp" // Para getText
|
||||
#include "options.hpp" // Para Gamepad
|
||||
#include "param.hpp" // Para Param, ParamGame, param
|
||||
#include "resource.hpp" // Para Resource
|
||||
#include "ui/window_message.hpp" // Para WindowMessage
|
||||
#include "utils.hpp" // Para Zone
|
||||
|
||||
DefineButtons::DefineButtons()
|
||||
: input_(Input::get()) {
|
||||
clearButtons();
|
||||
|
||||
auto gamepads = input_->getGamepads();
|
||||
for (const auto &gamepad : gamepads) {
|
||||
for (const auto& gamepad : gamepads) {
|
||||
controller_names_.emplace_back(Input::getControllerName(gamepad));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void DefineButtons::update(float delta_time) {
|
||||
}
|
||||
}
|
||||
|
||||
void DefineButtons::handleEvents(const SDL_Event &event) {
|
||||
void DefineButtons::handleEvents(const SDL_Event& event) {
|
||||
if (enabled_) {
|
||||
switch (event.type) {
|
||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||
@@ -81,7 +81,7 @@ void DefineButtons::handleEvents(const SDL_Event &event) {
|
||||
}
|
||||
}
|
||||
|
||||
auto DefineButtons::enable(Options::Gamepad *options_gamepad) -> bool {
|
||||
auto DefineButtons::enable(Options::Gamepad* options_gamepad) -> bool {
|
||||
if (options_gamepad != nullptr) {
|
||||
options_gamepad_ = options_gamepad;
|
||||
enabled_ = true;
|
||||
@@ -117,7 +117,7 @@ void DefineButtons::disable() {
|
||||
}
|
||||
}
|
||||
|
||||
void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event) {
|
||||
void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent& event) {
|
||||
auto gamepad = input_->getGamepad(event.which);
|
||||
|
||||
if (!gamepad || gamepad != options_gamepad_->instance) {
|
||||
@@ -132,7 +132,7 @@ void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event)
|
||||
}
|
||||
}
|
||||
|
||||
void DefineButtons::doControllerAxisMotion(const SDL_GamepadAxisEvent &event) {
|
||||
void DefineButtons::doControllerAxisMotion(const SDL_GamepadAxisEvent& event) {
|
||||
auto gamepad = input_->getGamepad(event.which);
|
||||
|
||||
if (!gamepad || gamepad != options_gamepad_->instance) {
|
||||
@@ -182,8 +182,8 @@ void DefineButtons::doControllerAxisMotion(const SDL_GamepadAxisEvent &event) {
|
||||
}
|
||||
}
|
||||
|
||||
void DefineButtons::bindButtons(Options::Gamepad *options_gamepad) {
|
||||
for (const auto &button : buttons_) {
|
||||
void DefineButtons::bindButtons(Options::Gamepad* options_gamepad) {
|
||||
for (const auto& button : buttons_) {
|
||||
Input::bindGameControllerButton(options_gamepad->instance, button.action, static_cast<SDL_GamepadButton>(button.button));
|
||||
}
|
||||
|
||||
@@ -200,13 +200,13 @@ void DefineButtons::incIndexButton() {
|
||||
}
|
||||
|
||||
auto DefineButtons::checkButtonNotInUse(SDL_GamepadButton button) -> bool {
|
||||
return std::ranges::all_of(buttons_, [button](const auto &b) {
|
||||
return std::ranges::all_of(buttons_, [button](const auto& b) {
|
||||
return b.button != button;
|
||||
});
|
||||
}
|
||||
|
||||
auto DefineButtons::checkTriggerNotInUse(int trigger_button) -> bool {
|
||||
return std::ranges::all_of(buttons_, [trigger_button](const auto &b) {
|
||||
return std::ranges::all_of(buttons_, [trigger_button](const auto& b) {
|
||||
return b.button != trigger_button;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user