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++) {