renomena tipus _t/_e a CamelCase (Circle, Color, Section, ...)
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
#include "core/resources/resource_helper.h" // for loadFile (pack + filesystem fallback)
|
||||
|
||||
// Parser compartido: lee un istream con el formato .ani
|
||||
static auto parseAnimationStream(std::istream &file, Texture *texture, const std::string &filename, bool verbose) -> animatedSprite_t {
|
||||
animatedSprite_t as;
|
||||
static auto parseAnimationStream(std::istream &file, Texture *texture, const std::string &filename, bool verbose) -> AnimatedSpriteData {
|
||||
AnimatedSpriteData as;
|
||||
as.texture = texture;
|
||||
int framesPerRow = 0;
|
||||
int frameWidth = 0;
|
||||
@@ -32,7 +32,7 @@ static auto parseAnimationStream(std::istream &file, Texture *texture, const std
|
||||
while (std::getline(file, line)) {
|
||||
strip_cr(line);
|
||||
if (line == "[animation]") {
|
||||
animation_t buffer;
|
||||
Animation buffer;
|
||||
buffer.speed = 0;
|
||||
buffer.loop = -1;
|
||||
buffer.counter = 0;
|
||||
@@ -98,14 +98,14 @@ static auto parseAnimationStream(std::istream &file, Texture *texture, const std
|
||||
}
|
||||
|
||||
// Carga la animación desde un fichero (vía ResourceHelper: pack si està inicialitzat, filesystem si no)
|
||||
auto loadAnimationFromFile(Texture *texture, const std::string &filePath, bool verbose) -> animatedSprite_t {
|
||||
auto loadAnimationFromFile(Texture *texture, const std::string &filePath, bool verbose) -> AnimatedSpriteData {
|
||||
const std::string filename = filePath.substr(filePath.find_last_of("\\/") + 1);
|
||||
auto bytes = ResourceHelper::loadFile(filePath);
|
||||
if (bytes.empty()) {
|
||||
if (verbose) {
|
||||
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << '\n';
|
||||
}
|
||||
animatedSprite_t as;
|
||||
AnimatedSpriteData as;
|
||||
as.texture = texture;
|
||||
return as;
|
||||
}
|
||||
@@ -113,9 +113,9 @@ auto loadAnimationFromFile(Texture *texture, const std::string &filePath, bool v
|
||||
}
|
||||
|
||||
// Carga la animación desde bytes en memoria
|
||||
auto loadAnimationFromMemory(Texture *texture, const std::vector<uint8_t> &bytes, const std::string &nameForLogs, bool verbose) -> animatedSprite_t {
|
||||
auto loadAnimationFromMemory(Texture *texture, const std::vector<uint8_t> &bytes, const std::string &nameForLogs, bool verbose) -> AnimatedSpriteData {
|
||||
if (bytes.empty()) {
|
||||
animatedSprite_t as;
|
||||
AnimatedSpriteData as;
|
||||
as.texture = texture;
|
||||
return as;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, const s
|
||||
|
||||
// Carga las animaciones
|
||||
if (!file.empty()) {
|
||||
animatedSprite_t as = loadAnimationFromFile(texture, file);
|
||||
AnimatedSpriteData as = loadAnimationFromFile(texture, file);
|
||||
|
||||
// Copia los datos de las animaciones
|
||||
animation.insert(animation.end(), as.animations.begin(), as.animations.end());
|
||||
@@ -145,7 +145,7 @@ AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, const s
|
||||
}
|
||||
|
||||
// Constructor
|
||||
AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, animatedSprite_t *animation)
|
||||
AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, AnimatedSpriteData *animation)
|
||||
: currentAnimation(0) {
|
||||
// Copia los punteros
|
||||
setTexture(animation->texture);
|
||||
@@ -299,7 +299,7 @@ auto AnimatedSprite::loadFromVector(std::vector<std::string> *source) -> bool {
|
||||
|
||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
||||
if (line == "[animation]") {
|
||||
animation_t buffer;
|
||||
Animation buffer;
|
||||
buffer.speed = 0;
|
||||
buffer.loop = -1;
|
||||
buffer.counter = 0;
|
||||
|
||||
Reference in New Issue
Block a user