BG类层,立绘层,字符层,ui层。目前还没有好的方法将这些层统一为一种概念,排序也没有考虑,Game逻辑部分管理BG, ACTOR层。
typedef enum {
SF_BAD = -,
SF_HIDE, // effect使用
SF_PIC, // bg, actor
SF_POLY, // 绘制多边形
SF_SHEET // 绘制字符,粒子类
}surfaceType_t;
bg及立绘层定义
struct drawSurf_t {
int sort;
surfaceType_t *surface;
drawSurf_t() : sort(-), surface(NULL) {}
};
struct srfPic_t {
surfaceType_t surfaceType;
ALLEGRO_BITMAP *image;
float sx, sy, sw, sh; //size
ALLEGRO_COLOR color;
float dx, dy, dw, dh;
float cx, cy, angle;
void Clear() {
surfaceType = SF_BAD;
image = NULL;
sx = sy = sw = sh = 0.0f;
color.a = ;
color.r = ;
color.g = ;
color.b = ;
dx = dy = dw = dh = ;
cx = cy = angle = ;
}
srfPic_t() {
Clear();
}
};
struct sheetSize_t {
float sx, sy, sw, sh;
float dx, dy;
};
struct srfSheet_t {
surfaceType_t surfaceType;
ALLEGRO_BITMAP *image;
ALLEGRO_COLOR color;
int numSheets;
sheetSize_t *sheets;
void Clear() {
surfaceType = SF_BAD;
image = NULL;
color.a = ;
color.r = ;
color.g = ;
color.b = ;
numSheets = ;
sheets = NULL;
}
srfSheet_t() {
Clear();
}
};