migrant a SDL3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <SDL3/SDL_rect.h> // Para SDL_Point
|
||||
#include <SDL3/SDL_rect.h> // Para SDL_FPoint
|
||||
#include <functional> // Para function
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <vector> // Para vector
|
||||
@@ -23,19 +24,19 @@ enum class PathCentered
|
||||
// Estructuras
|
||||
struct Path
|
||||
{
|
||||
std::vector<SDL_Point> spots; // Puntos por los que se desplazará el sprite
|
||||
int waiting_counter; // Tiempo de espera una vez en el destino
|
||||
bool on_destination = false; // Indica si ha llegado al destino
|
||||
bool finished = false; // Indica si ha terminado de esperarse
|
||||
int counter = 0; // Contador interno
|
||||
std::vector<SDL_FPoint> spots; // Puntos por los que se desplazará el sprite
|
||||
int waiting_counter; // Tiempo de espera una vez en el destino
|
||||
bool on_destination = false; // Indica si ha llegado al destino
|
||||
bool finished = false; // Indica si ha terminado de esperarse
|
||||
int counter = 0; // Contador interno
|
||||
|
||||
// Constructor
|
||||
Path(const std::vector<SDL_Point> &spots_init, int waiting_counter_init)
|
||||
Path(const std::vector<SDL_FPoint> &spots_init, int waiting_counter_init)
|
||||
: spots(spots_init), waiting_counter(waiting_counter_init) {}
|
||||
};
|
||||
|
||||
// Devuelve un vector con los puntos que conforman la ruta
|
||||
std::vector<SDL_Point> createPath(int start, int end, PathType type, int 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)> &easingFunction);
|
||||
|
||||
// Clase PathSprite
|
||||
class PathSprite : public Sprite
|
||||
@@ -69,7 +70,7 @@ public:
|
||||
|
||||
// Añade un recorrido
|
||||
void addPath(Path path, bool centered = false);
|
||||
void addPath(std::vector<SDL_Point> spots, int waiting_counter = 0);
|
||||
void addPath(std::vector<SDL_FPoint> spots, int waiting_counter = 0);
|
||||
void addPath(int start, int end, PathType type, int fixed_pos, int steps, const std::function<double(double)> &easingFunction, int waiting_counter = 0);
|
||||
|
||||
// Habilita el objeto
|
||||
|
||||
Reference in New Issue
Block a user