Skip to content

Commit

Permalink
Improved the Turtle Graphics demo. Changed the .NET version to 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nakov committed Feb 16, 2016
1 parent f43e69c commit f34930d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 22 deletions.
3 changes: 0 additions & 3 deletions Turtle-Graphics-Example/Program.cs
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Turtle_Graphics_Example
Expand Down
20 changes: 9 additions & 11 deletions Turtle-Graphics-Example/Turtle-Graphics-Example.csproj
Expand Up @@ -8,9 +8,10 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Turtle_Graphics_Example</RootNamespace>
<AssemblyName>Turtle-Graphics-Example</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -32,21 +33,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Nakov.TurtleGraphics, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nakov.TurtleGraphics.1.0.0.1\lib\net20\Nakov.TurtleGraphics.dll</HintPath>
<Reference Include="Nakov.TurtleGraphics, Version=1.0.0.2, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nakov.TurtleGraphics.1.0.0.2\lib\net20\Nakov.TurtleGraphics.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TurtleGraphicsDemoForm.cs">
Expand All @@ -57,6 +50,11 @@
</Compile>
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TurtleGraphicsDemoForm.resx">
<DependentUpon>TurtleGraphicsDemoForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
Expand Down
24 changes: 18 additions & 6 deletions Turtle-Graphics-Example/TurtleGraphicsDemoForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion Turtle-Graphics-Example/TurtleGraphicsDemoForm.cs
@@ -1,5 +1,6 @@
using Nakov.TurtleGraphics;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace Turtle_Graphics_Example
Expand All @@ -14,9 +15,10 @@ public TurtleGraphicsDemoForm()
private void buttonDraw_Click(object sender, EventArgs e)
{
// Assign a delay to visualize the drawing process
Turtle.Delay = 200;
Turtle.Delay = 150;

// Draw a equilateral triangle
Turtle.PenColor = Color.Green;
Turtle.Rotate(30);
Turtle.Forward(200);
Turtle.Rotate(120);
Expand All @@ -29,13 +31,28 @@ private void buttonDraw_Click(object sender, EventArgs e)
Turtle.PenUp();
Turtle.Backward(50);
Turtle.PenDown();
Turtle.PenColor = Color.Red;
Turtle.PenSize = 5;
Turtle.Backward(100);
Turtle.PenColor = Turtle.DefaultColor;
Turtle.PenSize = Turtle.DefaultPenSize;
Turtle.PenUp();
Turtle.Forward(150);
Turtle.PenDown();
Turtle.Rotate(30);
}

private void buttonDrawSpiral_Click(object sender, EventArgs e)
{
Turtle.PenColor = Color.Red;
Turtle.Delay = 50;
for (int i = 0; i < 25; i++)
{
Turtle.Forward(i * 5);
Turtle.Rotate(30 + i);
}
}

private void buttonReset_Click(object sender, EventArgs e)
{
Turtle.Reset();
Expand Down
2 changes: 1 addition & 1 deletion Turtle-Graphics-Example/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Nakov.TurtleGraphics" version="1.0.0.1" targetFramework="net46" />
<package id="Nakov.TurtleGraphics" version="1.0.0.2" targetFramework="net2" />
</packages>

1 comment on commit f34930d

@cle8cle
Copy link

@cle8cle cle8cle commented on f34930d Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turtle.Delay = 50;
Turtle.PenColor = Color.DarkGreen;
for (int i = 0; i < 36; i++)
{
Turtle.Forward(10);
Turtle.Rotate(10);
}

Please sign in to comment.