Compare commits

..

No commits in common. "main" and "v1.0.0" have entirely different histories.
main ... v1.0.0

5 changed files with 21 additions and 15 deletions

View File

@ -10,7 +10,7 @@ namespace FractalTreeGtk
internal class CairoWindow : Window
{
private int FractalLevels { get; set; } = 2;
readonly DrawingArea _drawing = new();
readonly DrawingArea _drawing = new DrawingArea();
Fractal _fractal = null!;
public CairoWindow(string title) : base(title)
@ -44,9 +44,9 @@ namespace FractalTreeGtk
FractalLevels--;
GenerateFractal();
}
break;
case Key.r: //Regenerate fractal
case Key.R:
GenerateFractal();
break;
}

View File

@ -6,10 +6,11 @@ namespace FractalTreeGtk.Draw
{
private readonly CairoWindow _window;
private double Length { get; set; } = new Random().Next(70, 90);
private int MaxLevels { get; }
private int CurrentLevel { get; set; }
private int MaxLevels { get; set; }
private int CurrentLevel { get; set; } = 0;
public bool IsDrawing { private set; get; }
private double Degree => new Random().Next(30, 50) / 100f;
private double DeltaLength => new Random().Next(0, 20) / (float)Math.Log2(CurrentLevel+1);
private double DeltaLength => new Random().Next(0, 50) / 100f;
public Branch[][] FractalLines { get; }
@ -37,7 +38,7 @@ namespace FractalTreeGtk.Draw
{
_window.QueueDraw();
var len = DeltaLength;
if (Length < 0)
if (Length < DeltaLength)
Length = DeltaLength;
else
Length -= DeltaLength;
@ -93,6 +94,7 @@ namespace FractalTreeGtk.Draw
{
NextLevel();
}
else IsDrawing = false;
}
}
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@ -1,14 +1,18 @@
using Gtk;
namespace FractalTreeGtk;
internal class Program
namespace FractalTreeGtk
{
static void Main()
internal class Program
{
Application.Init();
static void Main(string[] args)
{
Application.Init();
_ = new CairoWindow("Fractal window");
Application.Run();
//Create the Window
Window myWin = new CairoWindow("My first GTK# Application! ");
Application.Run();
}
}
}

View File

@ -1,5 +1,5 @@
# Fractal renderer on Gtk#
Simple drawer for fractal trees on Gtk# library and Cairo OpenGL
Drawer of fractal trees on Gtk# library
# How to use: