Skip to content

bstkhq/go-shapes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shapes

Go Reference

shapes is a package for Ebitengine (the 2D game library written by Hajime Hoshi) that allows rendering some common shapes and effects in complementary ways to the official vector package. Some examples:

  • Smooth circles, triangles, hexagons, ellipses, rings, rects... (all with the option of rounding).
  • High quality image outlines, expansions and blurs.
  • Simple patterns like dots, rhombuses and triangles.
  • Some color functions and gradients.
  • Other misc effects like noise, dithering, warps, quad mapping...

Unlike vector, shapes relies more on simple Kage shaders instead of raw triangles rasterization. This means rendering tends to be smoother, but extra care has to be taken as changing shaders or some of its parameters will break batching.

[TODO: simple UI surface example image]

Credit

Many of the SDFs are based on https://iquilezles.org/articles/distfunctions2d.

Pending improvements

  • Revise target origins being properly applied everywhere, and document target/source origins behavior clearly.
  • Missing proper rounding conventions. All shapes that accept rounding should support a positive rounding value for SDF expansion, and optionally, if inner rounding is allowed, handle it through negative values. Currently, most shapes do inner rounding with positive values, so newer functions can't even be properly adapted. This respects size boundaries but it's a missed opportunity.

About

Basic shapes and effects for Ebitengine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages