From 17be6b9daf74bbbf6733220a0eaa9ad116a876e6 Mon Sep 17 00:00:00 2001 From: Mikhail Abramov Date: Wed, 18 Apr 2018 22:18:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B8=D1=81=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=84=D0=BE=D0=BD=D0=B0=20(=D0=B4=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=BA=D0=B8=20=D0=B7=D0=B0=20=D0=9D=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8=D1=82=D0=BE=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit И пара мелких багов типа пропущенных точек с запятыми --- WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs | 4 ++-- WindowsFormsApplication1/WindowsFormsApplication1/Files.cs | 6 ++++-- .../WindowsFormsApplication1/MainForm.cs | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs index 7cfc5a4..9ed2191 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs @@ -13,7 +13,7 @@ namespace WindowsFormsApplication1 { File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\Personaj.bmp\");" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\" + Path.GetFileName(p.adress) + "\");" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); File.AppendAllText(filename, " " + name + ".x = 50;" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".y = 50;" + Environment.NewLine); @@ -24,7 +24,7 @@ namespace WindowsFormsApplication1 public static void MovePerson(string filename, string name, Person p) { - File.AppendAllText(filename, " " + name + ".angle++" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".angle++;" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".x = 500 + 200 * cos (" + name + ".angle / 10);" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".y = 300 + 200 * sin (" + name + ".angle / 10);" + Environment.NewLine); File.AppendAllText(filename, " txTransparentBlt(txDC(), " + name + ".x, " + name + ".y, " + p.width + "," + p.height + "," + name + ".texture, " + p.width + "/" + p.sprite + " * " + name + ".nomer_kadra, 0, RGB(0, 255, 255));" + Environment.NewLine); diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Files.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Files.cs index 6f7fe2c..03dbf6c 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/Files.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Files.cs @@ -38,7 +38,7 @@ namespace WindowsFormsApplication1 File.AppendAllText(filename, Environment.NewLine); } - public static void OpenMain(string filename, PictureBox PictureBoxBackground) + public static void OpenMain(string filename, PictureBox PictureBoxBackground, String adressBackground) { File.AppendAllText(filename, "int main()" + Environment.NewLine); File.AppendAllText(filename, "{" + Environment.NewLine); @@ -46,6 +46,7 @@ namespace WindowsFormsApplication1 PictureBoxBackground.Image.Width.ToString() + ", " + PictureBoxBackground.Image.Height.ToString() + ");" + Environment.NewLine); File.AppendAllText(filename, " double myTime = 0;" + Environment.NewLine); + File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\\\" + Path.GetFileName(adressBackground) + "\");" + Environment.NewLine); } public static void CloseWhile(string filename) @@ -63,11 +64,12 @@ namespace WindowsFormsApplication1 File.AppendAllText(filename, " {" + Environment.NewLine); File.AppendAllText(filename, " txSetColor(TX_RED);" + Environment.NewLine); File.AppendAllText(filename, " txSetFillColor(TX_RED);" + Environment.NewLine); - File.AppendAllText(filename, " txRectangle(0, 0, txGetExtentX(), txGetExtentY());" + Environment.NewLine); + File.AppendAllText(filename, " txBitBlt(txDC(), 0, 0, txGetExtentX(), txGetExtentY(), texture, 0, 0);" + Environment.NewLine); } public static void Ending(string filename) { + File.AppendAllText(filename, " txDeleteDC(texture);" + Environment.NewLine); File.AppendAllText(filename, " return 0;" + Environment.NewLine); File.AppendAllText(filename, "}" + Environment.NewLine); } diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs index 04a768c..0abfd1d 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs @@ -17,6 +17,7 @@ namespace WindowsFormsApplication1 int nomerPersa = 0; int pNomer = 0; PictureBox[] pic1 = new PictureBox[1000]; + String adressBackground = ""; public MainForm() { @@ -212,6 +213,7 @@ namespace WindowsFormsApplication1 if (openFileDialog1.ShowDialog() == DialogResult.Cancel) return; PictureBoxBackground.Image = Image.FromFile(openFileDialog1.FileName); + adressBackground = openFileDialog1.FileName; } private void SaveMultButton_Click(object sender, EventArgs e) @@ -228,9 +230,10 @@ namespace WindowsFormsApplication1 { Directory.CreateDirectory(adres_papki); } + File.Copy(adressBackground, adres_papki + "\\" + Path.GetFileName(adressBackground), true); Files.CreateStruct(filename); - Files.OpenMain(filename, PictureBoxBackground); + Files.OpenMain(filename, PictureBoxBackground, adressBackground); for (int nomer = 0; nomer < nomerPersa; nomer++) {