new option-based api for sprite issue
This commit is contained in:
@ -61,33 +61,14 @@ struct sprite_primitive_payload_without_color {
|
||||
*/
|
||||
/* TODO: it might make sense to infer alpha channel presence / meaningfulness for textures in atlas */
|
||||
/* so that they are rendered with no blend / batched in a way to reduce overdraw automatically */
|
||||
void push_sprite(char *path, t_frect rect) {
|
||||
void push_sprite(const t_push_sprite_args args) {
|
||||
struct sprite_primitive sprite = {
|
||||
.rect = rect,
|
||||
.color = (t_color) { 255, 255, 255, 255 },
|
||||
.rotation = 0.0,
|
||||
.texture_key = textures_get_key(&ctx.texture_cache, path),
|
||||
.flip_x = false,
|
||||
.flip_y = false,
|
||||
};
|
||||
|
||||
struct primitive_2d primitive = {
|
||||
.type = PRIMITIVE_2D_SPRITE,
|
||||
.sprite = sprite,
|
||||
};
|
||||
|
||||
arrput(ctx.render_queue_2d, primitive);
|
||||
}
|
||||
|
||||
|
||||
void push_sprite_ex(t_frect rect, t_push_sprite_args args) {
|
||||
struct sprite_primitive sprite = {
|
||||
.rect = rect,
|
||||
.color = args.color,
|
||||
.rotation = args.rotation,
|
||||
.rect = args.rect,
|
||||
.color = m_or(args, color, ((t_color) { 255, 255, 255, 255 })),
|
||||
.rotation = m_or(args, rotation, 0.0f),
|
||||
.texture_key = textures_get_key(&ctx.texture_cache, args.path),
|
||||
.flip_x = args.flip_x,
|
||||
.flip_y = args.flip_y,
|
||||
.flip_x = m_or(args, flip_x, false),
|
||||
.flip_y = m_or(args, flip_y, false),
|
||||
};
|
||||
|
||||
struct primitive_2d primitive = {
|
||||
|
Reference in New Issue
Block a user