added comments to render-related structs
parent
9dbb5a1566
commit
34593e0701
|
@ -20,41 +20,46 @@ typedef enum drawcmdtype_t {
|
||||||
|
|
||||||
typedef struct spritesheet_t {
|
typedef struct spritesheet_t {
|
||||||
SDL_Texture* texture;
|
SDL_Texture* texture;
|
||||||
int w, h;
|
int w, h; // width and height of texture
|
||||||
int tile_width, tile_height;
|
int tile_width, tile_height; // the width and height of each tile of each
|
||||||
} spritesheet_t;
|
} spritesheet_t; // sliced up sheet of sprites
|
||||||
|
|
||||||
|
typedef struct nineslice_t {
|
||||||
|
SDL_Texture* texture;
|
||||||
|
float corner_height, corner_width; // the width and height of the corners
|
||||||
|
} nineslice_t; // nine-sliced texture for ui
|
||||||
|
|
||||||
typedef struct sprite_t {
|
typedef struct sprite_t {
|
||||||
SDL_Texture* texture;
|
SDL_Texture* texture;
|
||||||
float x, y;
|
float x, y; // positions of x,y
|
||||||
SDL_FPoint origin;
|
SDL_FPoint origin; // the origin point on the sprite
|
||||||
float sx, sy;
|
float sx, sy; // the x and y scale of the sprite
|
||||||
float rot;
|
float rot; // rotation around origin of the sprite
|
||||||
depth_t depth;
|
depth_t depth; // depth to render at, lower is on top, higher is on bottom
|
||||||
SDL_Rect uv;
|
SDL_Rect uv; // the source rect to render from the texture
|
||||||
} sprite_t;
|
} sprite_t; // a drawable and transformable texture sprite
|
||||||
|
|
||||||
typedef struct rectshape_t {
|
typedef struct rectshape_t {
|
||||||
float x, y, w, h;
|
float x, y, w, h; // the top-left, width and height of a rect
|
||||||
float line_width;
|
float line_width; // the width of the lines
|
||||||
int depth;
|
int depth; // the depth to render at, lower is on top, higher is on bottom
|
||||||
SDL_Color background;
|
SDL_Color background; // the colour of the background
|
||||||
SDL_Color line;
|
SDL_Color line; // the colour of the line
|
||||||
} rectshape_t;
|
} rectshape_t; // a drawable rectangle with outline and background
|
||||||
|
|
||||||
typedef struct drawcmd_t {
|
typedef struct drawcmd_t {
|
||||||
drawcmdtype_t type;
|
drawcmdtype_t type; // the thing to render
|
||||||
depth_t depth;
|
depth_t depth; // the depth to render at
|
||||||
short ui;
|
short ui; // 0 if this should be rendered in world space, 1 if this should be rendered in ui space
|
||||||
union {
|
union {
|
||||||
sprite_t sprite;
|
sprite_t sprite; // if type is sprite, render this
|
||||||
rectshape_t rect;
|
rectshape_t rect; // if type is rect, render this
|
||||||
};
|
};
|
||||||
} drawcmd_t;
|
} drawcmd_t; // an orderable command to render, should not be directly used, use draw_* functions instead
|
||||||
|
|
||||||
typedef struct view_t {
|
typedef struct view_t {
|
||||||
float x, y;
|
float x, y; // the x,y position of the centre of the screen
|
||||||
float width;
|
float width; // the width of the camera
|
||||||
} view_t;
|
} view_t;
|
||||||
|
|
||||||
extern int _render_mode;
|
extern int _render_mode;
|
||||||
|
|
Loading…
Reference in New Issue