fase 1: jail i game a c++ idiomàtic (raii, info::ctx, cheats arreglats)
This commit is contained in:
@@ -1,40 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
|
||||
struct Frame {
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Uint16 w;
|
||||
Uint16 h;
|
||||
};
|
||||
|
||||
struct Animacio {
|
||||
Uint8 num_frames;
|
||||
Uint8* frames;
|
||||
};
|
||||
|
||||
struct Entitat {
|
||||
Uint8 num_frames;
|
||||
Frame* frames;
|
||||
Uint8 num_animacions;
|
||||
Animacio* animacions;
|
||||
};
|
||||
|
||||
class Sprite {
|
||||
public:
|
||||
Sprite(JD8_Surface gfx);
|
||||
~Sprite(void);
|
||||
|
||||
void draw();
|
||||
|
||||
Entitat* entitat;
|
||||
Uint8 cur_frame;
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Uint16 o;
|
||||
|
||||
protected:
|
||||
JD8_Surface gfx;
|
||||
Uint8 cycles_per_frame;
|
||||
};
|
||||
#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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user