40 lines
597 B
C++
40 lines
597 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:
|
|
Sprite(JD8_Surface gfx);
|
|
virtual ~Sprite() = default;
|
|
|
|
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;
|
|
};
|