Files
aee/source/game/sprite.hpp
T

40 lines
618 B
C++

#pragma once
#include <vector>
#include "core/jail/jdraw8.hpp"
struct Frame {
Uint16 x;
Uint16 y;
Uint16 w;
Uint16 h;
};
struct Animacio {
std::vector<Uint8> frames; // índexs dins d'Entitat::frames
};
struct Entitat {
std::vector<Frame> frames;
std::vector<Animacio> animacions;
};
class Sprite {
public:
explicit Sprite(Jd8::Surface gfx);
virtual ~Sprite() = default;
virtual void draw();
Entitat entitat;
Uint8 cur_frame = 0;
Uint16 x = 0;
Uint16 y = 0;
Uint16 o = 0;
protected:
Jd8::Surface gfx_;
Uint8 cycles_per_frame_ = 1;
};