Initial commit

This commit is contained in:
github-classroom[bot] 2025-02-25 17:02:53 +00:00 committed by GitHub
commit 0225d916ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 4423 additions and 0 deletions

53
Shapes/Program.cs Normal file
View file

@ -0,0 +1,53 @@
using System.Text;
using Shapes;
using Shapes.Shapes;
using SimpleDrawing;
using SimpleDrawing.Core;
Console.OutputEncoding = Encoding.UTF8;
const int Size = 600;
var shapes = new List<Shape>();
var generator = new ShapeGenerator(Size, Size);
LeoCanvas.Init(Run, Size, Size, clickAction: HandleClick, windowTitle: "Shapes");
return;
void Run()
{
try
{
// initial rendering
Redraw();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
void HandleClick(ClickEvent @event)
{
// TODO - handle click at location
Redraw();
}
void Redraw()
{
LeoCanvas.Clear();
foreach (var shape in shapes)
{
if (!shape.DrawSelf())
{
Console.WriteLine($"Couldn't draw shape with id {shape.Id} 😭");
}
}
LeoCanvas.Render();
}