Apos.Shapes - Shape rendering in MonoGame.

I created a new library for drawing shapes.


Currently supports drawing filled circles and rectangles with a border. It works similarly to the SpriteBatch. I tested it on the DesktopGL and WindowsDX platforms. I’m using SDFs which means the shapes should look good at any size.

using Apos.Shapes;

// ...

_graphics.GraphicsProfile = GraphicsProfile.HiDef;

// ...

ShapeBatch _sb = new ShapeBatch(GraphicsDevice, Content);

// ...

_sb.DrawCircle(new Vector2(100f, 0f), 100f, Color.Red, Color.White, 4f);
_sb.DrawCircle(new Vector2(100, 100), 50, Color.Red, Color.White, 4f);
_sb.DrawCircle(new Vector2(170, 150), 75, Color.Blue * 0.5f, Color.White, 2f);
_sb.DrawRectangle(new Vector2(400, 120), new Vector2(100, 200), Color.Green, Color.White, 10f);

I’ll be adding more shapes over time including stuff like rounded rectangles.


Very nice thats going to be super handy. Especially when mocking up game ideas without having to load in sprites etc

You should add a draw rectangle overload that rotates the rectangle, altho your input parameter would probably have to be a center location as a well as width and height

I’m thinking of adding an overload that takes in a matrix32. That would allow you to do any world transformation including skewing.

btw, for now you can already pass a view matrix to the begin call. Not exactly the same though since it would transform the whole batch.

1 Like

True. But also keeping it similar to spritebatch rotation would be nice to where you just pass a float radian in for rotation. But you would need to pass a center vector, width, height and rotation

That could work, it would be backed by the matrix32 behind the scene.

Version 0.1.2 is out!


  • Shapes weren’t drawn at the correct position


  • The ShapeBatch should be slightly faster

Version 0.1.3 is out!


  • Line segments. The end caps are rounded.


  • Anti-aliasing between main color and border color

Come on, what’s with the outdated begin/end approach.

What would you suggest instead?

No begin/end whatsoever.

Can you show an example of what your API would look like?

This, if we are going extreme barebones.

But ideally, FlushBatch will be called automatically (which it is, in high-level monofoxe API)