diff --git a/Traktor/Traktor/Direction.cs b/Traktor/Traktor/Direction.cs
new file mode 100644
index 0000000..a764490
--- /dev/null
+++ b/Traktor/Traktor/Direction.cs
@@ -0,0 +1,11 @@
+namespace Traktor
+{
+ //Направление перемещения
+ internal enum Direction
+ {
+ Up = 1,
+ Down = 2,
+ Left = 3,
+ Right = 4
+ }
+}
diff --git a/Traktor/Traktor/DrawField.Designer.cs b/Traktor/Traktor/DrawField.Designer.cs
new file mode 100644
index 0000000..0455f1e
--- /dev/null
+++ b/Traktor/Traktor/DrawField.Designer.cs
@@ -0,0 +1,181 @@
+namespace Traktor
+{
+ partial class DrawField
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.pictureBoxTraktor = new System.Windows.Forms.PictureBox();
+ this.statusStrip = new System.Windows.Forms.StatusStrip();
+ this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
+ this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
+ this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonLEFT = new System.Windows.Forms.Button();
+ this.buttonRIGHT = new System.Windows.Forms.Button();
+ this.buttonDOWN = new System.Windows.Forms.Button();
+ this.buttonUP = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxTraktor)).BeginInit();
+ this.statusStrip.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pictureBoxTraktor
+ //
+ this.pictureBoxTraktor.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBoxTraktor.Location = new System.Drawing.Point(0, 0);
+ this.pictureBoxTraktor.Name = "pictureBoxTraktor";
+ this.pictureBoxTraktor.Size = new System.Drawing.Size(800, 425);
+ this.pictureBoxTraktor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ this.pictureBoxTraktor.TabIndex = 0;
+ this.pictureBoxTraktor.TabStop = false;
+ this.pictureBoxTraktor.Resize += new System.EventHandler(this.PictureBoxTraktor_Resize);
+ //
+ // statusStrip
+ //
+ this.statusStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripStatusLabelSpeed,
+ this.toolStripStatusLabelWeight,
+ this.toolStripStatusLabelBodyColor});
+ this.statusStrip.Location = new System.Drawing.Point(0, 425);
+ this.statusStrip.Name = "statusStrip";
+ this.statusStrip.Size = new System.Drawing.Size(800, 26);
+ this.statusStrip.TabIndex = 1;
+ //
+ // toolStripStatusLabelSpeed
+ //
+ this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
+ this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(80, 20);
+ this.toolStripStatusLabelSpeed.Text = "Скорость: ";
+ //
+ // toolStripStatusLabelWeight
+ //
+ this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
+ this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(40, 20);
+ this.toolStripStatusLabelWeight.Text = "Вес: ";
+ //
+ // toolStripStatusLabelBodyColor
+ //
+ this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor";
+ this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(95, 20);
+ this.toolStripStatusLabelBodyColor.Text = "Цвет кузова:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonCreate.Location = new System.Drawing.Point(29, 363);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(94, 29);
+ this.buttonCreate.TabIndex = 2;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click);
+ //
+ // buttonLEFT
+ //
+ this.buttonLEFT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonLEFT.BackgroundImage = global::Traktor.Properties.Resources.arrowLeft;
+ this.buttonLEFT.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonLEFT.Location = new System.Drawing.Point(673, 361);
+ this.buttonLEFT.Name = "buttonLEFT";
+ this.buttonLEFT.Size = new System.Drawing.Size(30, 29);
+ this.buttonLEFT.TabIndex = 3;
+ this.buttonLEFT.UseVisualStyleBackColor = true;
+ this.buttonLEFT.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // buttonRIGHT
+ //
+ this.buttonRIGHT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonRIGHT.BackgroundImage = global::Traktor.Properties.Resources.arrowRight;
+ this.buttonRIGHT.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonRIGHT.Location = new System.Drawing.Point(745, 361);
+ this.buttonRIGHT.Name = "buttonRIGHT";
+ this.buttonRIGHT.Size = new System.Drawing.Size(30, 29);
+ this.buttonRIGHT.TabIndex = 4;
+ this.buttonRIGHT.UseVisualStyleBackColor = true;
+ this.buttonRIGHT.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // buttonDOWN
+ //
+ this.buttonDOWN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonDOWN.BackgroundImage = global::Traktor.Properties.Resources.arrowDown;
+ this.buttonDOWN.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonDOWN.Location = new System.Drawing.Point(709, 379);
+ this.buttonDOWN.Name = "buttonDOWN";
+ this.buttonDOWN.Size = new System.Drawing.Size(30, 29);
+ this.buttonDOWN.TabIndex = 5;
+ this.buttonDOWN.UseVisualStyleBackColor = true;
+ this.buttonDOWN.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // buttonUP
+ //
+ this.buttonUP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonUP.BackgroundImage = global::Traktor.Properties.Resources.arrowUp;
+ this.buttonUP.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonUP.Location = new System.Drawing.Point(709, 343);
+ this.buttonUP.Name = "buttonUP";
+ this.buttonUP.Size = new System.Drawing.Size(30, 29);
+ this.buttonUP.TabIndex = 6;
+ this.buttonUP.UseVisualStyleBackColor = true;
+ this.buttonUP.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // DrawField
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 451);
+ this.Controls.Add(this.buttonUP);
+ this.Controls.Add(this.buttonDOWN);
+ this.Controls.Add(this.buttonRIGHT);
+ this.Controls.Add(this.buttonLEFT);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.pictureBoxTraktor);
+ this.Controls.Add(this.statusStrip);
+ this.Name = "DrawField";
+ this.Text = "Трактор";
+ this.Click += new System.EventHandler(this.ButtonMove_Click);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxTraktor)).EndInit();
+ this.statusStrip.ResumeLayout(false);
+ this.statusStrip.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxTraktor;
+ private StatusStrip statusStrip;
+ private ToolStripStatusLabel toolStripStatusLabelSpeed;
+ private ToolStripStatusLabel toolStripStatusLabelWeight;
+ private ToolStripStatusLabel toolStripStatusLabelBodyColor;
+ private Button buttonCreate;
+ private Button buttonLEFT;
+ private Button buttonRIGHT;
+ private Button buttonDOWN;
+ private Button buttonUP;
+ }
+}
\ No newline at end of file
diff --git a/Traktor/Traktor/DrawField.cs b/Traktor/Traktor/DrawField.cs
new file mode 100644
index 0000000..9785d3d
--- /dev/null
+++ b/Traktor/Traktor/DrawField.cs
@@ -0,0 +1,62 @@
+namespace Traktor
+{
+ public partial class DrawField : Form
+ {
+ private TraktorDraw _Traktor;
+
+ public DrawField()
+ {
+ InitializeComponent();
+ }
+
+ //
+ private void Draw()
+ {
+ Bitmap bmp = new(pictureBoxTraktor.Width, pictureBoxTraktor.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _Traktor?.DrawEntity(gr);
+ pictureBoxTraktor.Image = bmp;
+ }
+
+ //
+ private void ButtonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new Random();
+ _Traktor = new TraktorDraw();
+ _Traktor.Init(random.Next(100, 200), random.Next(2500, 5000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
+ _Traktor.SetPosition(random.Next(10, 50), random.Next(10, 50), pictureBoxTraktor.Width, pictureBoxTraktor.Height);
+ toolStripStatusLabelSpeed.Text = $": {_Traktor.Traktor.Speed}";
+ toolStripStatusLabelWeight.Text = $": {_Traktor.Traktor.Weight}";
+ toolStripStatusLabelBodyColor.Text = $" : {_Traktor.Traktor.BodyColor.Name}";
+ Draw();
+ }
+
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ //
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUP":
+ _Traktor?.MoveTransport(Direction.Up);
+ break;
+ case "buttonDOWN":
+ _Traktor?.MoveTransport(Direction.Down);
+ break;
+ case "buttonLEFT":
+ _Traktor?.MoveTransport(Direction.Left);
+ break;
+ case "buttonRIGHT":
+ _Traktor?.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+ }
+
+ private void PictureBoxTraktor_Resize(object sender, EventArgs e)
+ {
+ _Traktor?.ChangeBorders(pictureBoxTraktor.Width, pictureBoxTraktor.Height);
+ Draw();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Traktor/Traktor/DrawField.resx b/Traktor/Traktor/DrawField.resx
new file mode 100644
index 0000000..2c0949d
--- /dev/null
+++ b/Traktor/Traktor/DrawField.resx
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/Traktor/Traktor/EntityTraktor.cs b/Traktor/Traktor/EntityTraktor.cs
new file mode 100644
index 0000000..28a65b6
--- /dev/null
+++ b/Traktor/Traktor/EntityTraktor.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Traktor
+{
+
+ //Класс-сущности "Трактор"
+
+ internal class EntityTraktor
+ {
+ //Скорость
+ public int Speed { get; private set; }
+ //Вес
+ public float Weight { get; private set; }
+ //Цвет кузова
+ public Color BodyColor { get; private set; }
+ //Шаг перемещения трактора
+ public float Step => Speed * 100 / Weight;
+
+ public void Init(int speed, float weight, Color bodycolor)
+ {
+ Random rnd = new Random();
+ Speed = speed <= 0 ? rnd.Next(50, 150) : speed;
+ Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
+ BodyColor = bodycolor;
+ }
+ }
+}
diff --git a/Traktor/Traktor/Form1.Designer.cs b/Traktor/Traktor/Form1.Designer.cs
deleted file mode 100644
index 552ebe5..0000000
--- a/Traktor/Traktor/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace Traktor
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Traktor/Traktor/Form1.cs b/Traktor/Traktor/Form1.cs
deleted file mode 100644
index fb1db22..0000000
--- a/Traktor/Traktor/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Traktor
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/Traktor/Traktor/Program.cs b/Traktor/Traktor/Program.cs
index 6bdd61c..c7b1b20 100644
--- a/Traktor/Traktor/Program.cs
+++ b/Traktor/Traktor/Program.cs
@@ -11,7 +11,7 @@ namespace Traktor
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new DrawField());
}
}
}
\ No newline at end of file
diff --git a/Traktor/Traktor/Properties/Resources.Designer.cs b/Traktor/Traktor/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..f6f63c8
--- /dev/null
+++ b/Traktor/Traktor/Properties/Resources.Designer.cs
@@ -0,0 +1,114 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace Traktor.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Traktor.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowDown {
+ get {
+ object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowLeft {
+ get {
+ object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowRight {
+ get {
+ object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowUp {
+ get {
+ object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap kisspng_computer_icons_arrow_encapsulated_postscript_left_arrow_5ac00b2487fba8_612718301522535204557 {
+ get {
+ object obj = ResourceManager.GetObject("kisspng-computer-icons-arrow-encapsulated-postscript-left-arrow-5ac00b2487fba8.61" +
+ "2718301522535204557", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/Traktor/Traktor/Form1.resx b/Traktor/Traktor/Properties/Resources.resx
similarity index 78%
rename from Traktor/Traktor/Form1.resx
rename to Traktor/Traktor/Properties/Resources.resx
index 1af7de1..b0b0fbb 100644
--- a/Traktor/Traktor/Form1.resx
+++ b/Traktor/Traktor/Properties/Resources.resx
@@ -117,4 +117,20 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Resources\kisspng-computer-icons-arrow-encapsulated-postscript-left-arrow-5ac00b2487fba8.612718301522535204557.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/Traktor/Traktor/Resources/arrowDown.png b/Traktor/Traktor/Resources/arrowDown.png
new file mode 100644
index 0000000..56c7aaf
Binary files /dev/null and b/Traktor/Traktor/Resources/arrowDown.png differ
diff --git a/Traktor/Traktor/Resources/arrowLeft.png b/Traktor/Traktor/Resources/arrowLeft.png
new file mode 100644
index 0000000..55b0ae9
Binary files /dev/null and b/Traktor/Traktor/Resources/arrowLeft.png differ
diff --git a/Traktor/Traktor/Resources/arrowRight.png b/Traktor/Traktor/Resources/arrowRight.png
new file mode 100644
index 0000000..9a3a8c1
Binary files /dev/null and b/Traktor/Traktor/Resources/arrowRight.png differ
diff --git a/Traktor/Traktor/Resources/arrowUp.png b/Traktor/Traktor/Resources/arrowUp.png
new file mode 100644
index 0000000..3a10dd6
Binary files /dev/null and b/Traktor/Traktor/Resources/arrowUp.png differ
diff --git a/Traktor/Traktor/Resources/kisspng-computer-icons-arrow-encapsulated-postscript-left-arrow-5ac00b2487fba8.612718301522535204557.png b/Traktor/Traktor/Resources/kisspng-computer-icons-arrow-encapsulated-postscript-left-arrow-5ac00b2487fba8.612718301522535204557.png
new file mode 100644
index 0000000..9a3a8c1
Binary files /dev/null and b/Traktor/Traktor/Resources/kisspng-computer-icons-arrow-encapsulated-postscript-left-arrow-5ac00b2487fba8.612718301522535204557.png differ
diff --git a/Traktor/Traktor/Traktor.csproj b/Traktor/Traktor/Traktor.csproj
index b57c89e..13ee123 100644
--- a/Traktor/Traktor/Traktor.csproj
+++ b/Traktor/Traktor/Traktor.csproj
@@ -8,4 +8,19 @@
enable
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/Traktor/Traktor/TraktorDraw.cs b/Traktor/Traktor/TraktorDraw.cs
new file mode 100644
index 0000000..5291f70
--- /dev/null
+++ b/Traktor/Traktor/TraktorDraw.cs
@@ -0,0 +1,147 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+//test
+
+namespace Traktor
+{
+ // Класс, отвечающий за прорисовку и перемещение объекта-сущности
+ internal class TraktorDraw
+ {
+ //Сущность
+ public EntityTraktor Traktor { get; private set; }
+ /// Левая координата отрисовки сущности
+ private float startPosX;
+ /// Верхняя кооридната отрисовки сущности
+ private float startPosY;
+ /// Ширина окна отрисовки
+ private int? pictureWidth = null;
+ /// Высота окна отрисовки
+ private int? pictureHeight = null;
+ /// Ширина отрисовки сущности
+ private readonly int entWidth = 130;
+ /// Высота отрисовки сущности
+ private readonly int entHeight = 100;
+
+ public void Init(int speed, float weight, Color bodycolor)
+ {
+ Traktor = new EntityTraktor();
+ Traktor.Init(speed, weight, bodycolor);
+ }
+
+ //Установка позиции сущности
+ public void SetPosition(int x, int y, int width, int height)
+ {
+ if (x < 0 || y < 0 || width < x + entWidth || height < y + entHeight)
+ {
+ pictureHeight = null;
+ pictureWidth = null;
+ return;
+ }
+ startPosX = x;
+ startPosY = y;
+ pictureHeight = height;
+ pictureWidth = width;
+ }
+
+ //Изменение направления перемещения
+ public void MoveTransport(Direction direction)
+ {
+ if (!pictureWidth.HasValue || !pictureHeight.HasValue)
+ {
+ return;
+ }
+ switch (direction)
+ {
+ case Direction.Right:
+ if (startPosX + entWidth + Traktor.Step < pictureWidth)
+ {
+ startPosX += Traktor.Step;
+ }
+ break;
+ case Direction.Left:
+ if (startPosX-10 - Traktor.Step > 0)
+ {
+ startPosX -= Traktor.Step;
+ }
+ break;
+ case Direction.Down:
+ if (startPosY + entHeight + Traktor.Step < pictureHeight)
+ {
+ startPosY += Traktor.Step;
+ }
+ break;
+ case Direction.Up:
+ if (startPosY - Traktor.Step > 0)
+ {
+ startPosY -= Traktor.Step;
+ }
+ break;
+ }
+ }
+
+ //Отрисовка сущности
+ public void DrawEntity(Graphics g)
+ {
+ if (startPosX < 0 || startPosY < 0 || !pictureHeight.HasValue || !pictureWidth.HasValue)
+ {
+ return;
+ }
+
+ Pen pen_Black_1pxl = new Pen(Color.Black, 1);
+ Pen pen_Black_2pxl = new Pen(Color.Black, 2);
+
+ g.DrawRectangle(pen_Black_1pxl, startPosX, startPosY, 40, 30);
+ g.DrawRectangle(pen_Black_1pxl, startPosX, startPosY + 30, 100, 35);
+ g.DrawRectangle(pen_Black_1pxl, startPosX+72, startPosY + 10, 5, 20);
+ g.DrawEllipse(pen_Black_1pxl, startPosX-15, startPosY+67, 30, 30);
+ g.DrawEllipse(pen_Black_1pxl, startPosX+85, startPosY + 67, 30, 30);
+ g.DrawEllipse(pen_Black_1pxl, startPosX + 20, startPosY + 82, 15, 15);
+ g.DrawEllipse(pen_Black_1pxl, startPosX + 40, startPosY + 82, 15, 15);
+ g.DrawEllipse(pen_Black_1pxl, startPosX + 60, startPosY + 82, 15, 15);
+ g.DrawEllipse(pen_Black_1pxl, startPosX + 35, startPosY + 68, 10, 10);
+ g.DrawEllipse(pen_Black_1pxl, startPosX + 55, startPosY + 68, 10, 10);
+
+ g.DrawLine(pen_Black_2pxl, startPosX, startPosY + 67, startPosX + 100, startPosY + 67);
+ g.DrawLine(pen_Black_2pxl, startPosX, startPosY + 97, startPosX + 100, startPosY + 97);
+
+ Brush br = new SolidBrush(Traktor?.BodyColor ?? Color.Black);
+ g.FillRectangle(br, startPosX, startPosY, 40, 30);
+ g.FillRectangle(br, startPosX, startPosY + 30, 100, 35);
+
+ Brush brBlack = new SolidBrush(Color.Black);
+ g.FillRectangle(brBlack, startPosX + 72, startPosY + 10, 5, 20);
+ g.FillEllipse(brBlack, startPosX - 15, startPosY + 67, 30, 30);
+ g.FillEllipse(brBlack, startPosX + 85, startPosY + 67, 30, 30);
+ g.FillEllipse(brBlack, startPosX + 20, startPosY + 82, 15, 15);
+ g.FillEllipse(brBlack, startPosX + 40, startPosY + 82, 15, 15);
+ g.FillEllipse(brBlack, startPosX + 60, startPosY + 82, 15, 15);
+ g.FillEllipse(brBlack, startPosX + 35, startPosY + 68, 10, 10);
+ g.FillEllipse(brBlack, startPosX + 55, startPosY + 68, 10, 10);
+ }
+
+ //Смена границ формы
+ public void ChangeBorders(int width, int height)
+ {
+ pictureWidth = width;
+ pictureHeight = height;
+ if (pictureWidth <= entWidth || pictureHeight <= entHeight)
+ {
+ pictureWidth = null;
+ pictureHeight = null;
+ return;
+ }
+ if (startPosX + entWidth > pictureWidth)
+ {
+ startPosX = pictureWidth.Value - entWidth;
+ }
+ if (startPosY + entHeight > pictureHeight)
+ {
+ startPosY = pictureHeight.Value - entHeight;
+ }
+ }
+ }
+}
\ No newline at end of file