Skip to content

CF_SpriteEdge

Category: draw
GitHub: cute_draw.h


Control the appearance of a sprite's edge at the border.

Values

Enum Description
CF_SPRITE_EDGE_SOFT The quad extends one pixel past the image on all sides, softening silhouettes. The default.
CF_SPRITE_EDGE_HARD The quad covers exactly the image, so neighboring sprites meet without overlapping.

Remarks

Sprites are packed into an atlas with a 1 pixel ring of transparent pixels, so that filtering along an image's edge can't bleed into a neighboring image.

CF_SPRITE_EDGE_SOFT draw a sprite with that ring included. This gives the sprite a nice soft edge when rotated. However, sprites put adjacent to each other (e.g: in a tilemap) will show a transparent seam. This is the default.

CF_SPRITE_EDGE_HARD covers only the image, so neighbors meet seamlessly at any camera offset or zoom, at the cost of hard, aliased silhouettes when rotated. This should be used for tilemaps, and for sprites used as panels placed next to each other.

Sprites from a premade atlas (see cf_register_premade_atlas) have no ring to sample, and are always drawn as if CF_SPRITE_EDGE_HARD.

cf_draw_peek_sprite_edge
cf_sprite_edge_to_string
cf_draw_push_sprite_edge
cf_draw_pop_sprite_edge