fase 1: jail i game a c++ idiomàtic (raii, info::ctx, cheats arreglats)

This commit is contained in:
2026-04-15 18:03:46 +02:00
parent 2c833d086e
commit 7f85b50c63
18 changed files with 834 additions and 804 deletions

View File

@@ -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;
};