Skip to content

FNA-NET/FNA.NET.Shapes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet NuGet

FNA.NET.Shapes

Shape rendering library for FNA.NET. It's forked from https://github.com/Apostolique/Apos.Shapes

Description

This library draws shapes using SDFs. Special thanks to Inigo Quilez for doing a lot of the work on the math functions.

Features

  • Circles
  • Lines
  • Rectangles
  • Hexagons
  • Equilateral Triangles
  • Ellipses
  • Filled + Borders
  • Rounded
  • Rotations

Usage samples

Install with:

dotnet add package FNA.NET.Shapes

Add to your Game1.cs:

using Apos.Shapes;

// ...

_graphics.GraphicsProfile = GraphicsProfile.HiDef;

// ...

ShapeBatch _sb = new ShapeBatch(GraphicsDevice, Content);

// ...

_sb.Begin();
_sb.BorderLine(new Vector2(100, 20), new Vector2(450, -15), 20, Color.White, 2f);

_sb.DrawCircle(new Vector2(120, 120), 75, new Color(96, 165, 250), new Color(191, 219, 254), 4f);
_sb.DrawCircle(new Vector2(120, 120), 30, Color.White, Color.Black, 20f);

_sb.DrawCircle(new Vector2(370, 120), 100, new Color(96, 165, 250), new Color(191, 219, 254), 4f);
_sb.DrawCircle(new Vector2(370, 120), 40, Color.White, Color.Black, 20f);

_sb.DrawCircle(new Vector2(190, 270), 10, Color.Black, Color.White, 2f);
_sb.DrawCircle(new Vector2(220, 270), 10, Color.Black, Color.White, 2f);

_sb.FillCircle(new Vector2(235, 400), 30, new Color(220, 38, 38));
_sb.FillRectangle(new Vector2(235, 370), new Vector2(135, 60), new Color(220, 38, 38));
_sb.FillCircle(new Vector2(235, 400), 20, Color.White);
_sb.FillRectangle(new Vector2(235, 380), new Vector2(125, 40), Color.White);
_sb.End();

Other projects you might like

About

Shape rendering library for FNA.NET.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 90.6%
  • HLSL 9.4%