C
C#16mo ago
leviathan_0

Simple 2D graphics in C#

I want to make a 2D physics engine (mostly for learning), and I need a way to visualise the simulations I run. I want something that is simple to use, lightweight and (ideally) cross-platform. I need it to provide a direct way to open a window and draw basic shapes onto a canvas (circles/ellipses, polygons), providing me with full control over aspects like colour and line width. In brief, I'm looking for something like Processing but for C#.
5 Replies
Anton
Anton16mo ago
Take a look at monogame I've also heard good things about the osu engine
Kouhai
Kouhai16mo ago
iirc drawing primitive shapes in monogame isn't straightforward
leviathan_0
leviathan_016mo ago
Indeed, it ins't straightforward at all. From what I read, I'd need to add a texture for every primitive I wanted. I'm looking for something that allows me to do something like:
Circle(new Vec(0,0), 5);
Polygon(new Vec(0,0), new Vec(2,2), new Vec(1,0));
Circle(new Vec(0,0), 5);
Polygon(new Vec(0,0), new Vec(2,2), new Vec(1,0));
(syntax is merely illustrative)
Kouhai
Kouhai16mo ago
Yeah, you have to either construct textures at runtime or use 3rd primitive stuff. Idk if you need a feature rich framework, but raylib is very good for basic graphics https://github.com/ChrisDill/Raylib-cs
GitHub
GitHub - ChrisDill/Raylib-cs: C# bindings for raylib, a simple and ...
C# bindings for raylib, a simple and easy-to-use library to learn videogames programming - GitHub - ChrisDill/Raylib-cs: C# bindings for raylib, a simple and easy-to-use library to learn videogames...
leviathan_0
leviathan_016mo ago
Thanks! That is exactly what I was looking for!