jugant amb clang-tidy
This commit is contained in:
@@ -6,16 +6,16 @@
|
||||
#include <utility> // Para move
|
||||
|
||||
// Devuelve un vector con los puntos que conforman la ruta
|
||||
std::vector<SDL_FPoint> createPath(float start, float end, PathType type, float fixed_pos, int steps, const std::function<double(double)> &easingFunction) {
|
||||
std::vector<SDL_FPoint> createPath(float start, float end, PathType type, float fixed_pos, int steps, const std::function<double(double)> &easing_function) {
|
||||
std::vector<SDL_FPoint> v;
|
||||
v.reserve(steps);
|
||||
|
||||
for (int i = 0; i < steps; ++i) {
|
||||
double t = static_cast<double>(i) / (steps - 1);
|
||||
double value = start + (end - start) * easingFunction(t);
|
||||
double value = start + (end - start) * easing_function(t);
|
||||
|
||||
if ((start > 0 && end < 0) || (start < 0 && end > 0)) {
|
||||
value = start + (end > 0 ? 1 : -1) * std::abs(end - start) * easingFunction(t);
|
||||
value = start + (end > 0 ? 1 : -1) * std::abs(end - start) * easing_function(t);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
@@ -56,16 +56,16 @@ void PathSprite::addPath(Path path, bool centered) {
|
||||
|
||||
switch (path_centered) {
|
||||
case PathCentered::ON_X: {
|
||||
const int x = path.spots.back().x - pos_.w / 2;
|
||||
const int X = path.spots.back().x - pos_.w / 2;
|
||||
for (auto &spot : path.spots)
|
||||
spot.x = x;
|
||||
spot.x = X;
|
||||
paths_.emplace_back(path);
|
||||
break;
|
||||
}
|
||||
case PathCentered::ON_Y: {
|
||||
const int y = path.spots.back().y - pos_.h / 2;
|
||||
const int Y = path.spots.back().y - pos_.h / 2;
|
||||
for (auto &spot : path.spots)
|
||||
spot.y = y;
|
||||
spot.y = Y;
|
||||
paths_.emplace_back(path);
|
||||
break;
|
||||
}
|
||||
@@ -76,8 +76,8 @@ void PathSprite::addPath(Path path, bool centered) {
|
||||
}
|
||||
|
||||
// Añade un recorrido
|
||||
void PathSprite::addPath(int start, int end, PathType type, int fixed_pos, int steps, const std::function<double(double)> &easingFunction, int waiting_counter) {
|
||||
paths_.emplace_back(createPath(start, end, type, fixed_pos, steps, easingFunction), waiting_counter);
|
||||
void PathSprite::addPath(int start, int end, PathType type, int fixed_pos, int steps, const std::function<double(double)> &easing_function, int waiting_counter) {
|
||||
paths_.emplace_back(createPath(start, end, type, fixed_pos, steps, easing_function), waiting_counter);
|
||||
}
|
||||
|
||||
// Añade un recorrido
|
||||
@@ -95,8 +95,8 @@ void PathSprite::enable() {
|
||||
|
||||
// Establece la posición
|
||||
auto &path = paths_.at(current_path_);
|
||||
const auto &P = path.spots.at(path.counter);
|
||||
setPosition(P);
|
||||
const auto &p = path.spots.at(path.counter);
|
||||
setPosition(p);
|
||||
}
|
||||
|
||||
// Coloca el sprite en los diferentes puntos del recorrido
|
||||
|
||||
Reference in New Issue
Block a user