Рисование фона (доделки за Никитой)

И пара мелких багов типа пропущенных точек с запятыми
This commit is contained in:
Mikhail Abramov 2018-04-18 22:18:34 +03:00 committed by GitHub
parent 536431d47f
commit 17be6b9daf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View file

@ -13,7 +13,7 @@ namespace WindowsFormsApplication1
{ {
File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine); File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine);
File.AppendAllText(filename, 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, Environment.NewLine);
File.AppendAllText(filename, " " + name + ".x = 50;" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".x = 50;" + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".y = 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) 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 + ".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, " " + 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); 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);

View file

@ -38,7 +38,7 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, Environment.NewLine); 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, "int main()" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine); File.AppendAllText(filename, "{" + Environment.NewLine);
@ -46,6 +46,7 @@ namespace WindowsFormsApplication1
PictureBoxBackground.Image.Width.ToString() + ", " + PictureBoxBackground.Image.Width.ToString() + ", " +
PictureBoxBackground.Image.Height.ToString() + ");" + Environment.NewLine); PictureBoxBackground.Image.Height.ToString() + ");" + Environment.NewLine);
File.AppendAllText(filename, " double myTime = 0;" + 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) public static void CloseWhile(string filename)
@ -63,11 +64,12 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, " {" + Environment.NewLine); File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " txSetColor(TX_RED);" + Environment.NewLine); File.AppendAllText(filename, " txSetColor(TX_RED);" + Environment.NewLine);
File.AppendAllText(filename, " txSetFillColor(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) public static void Ending(string filename)
{ {
File.AppendAllText(filename, " txDeleteDC(texture);" + Environment.NewLine);
File.AppendAllText(filename, " return 0;" + Environment.NewLine); File.AppendAllText(filename, " return 0;" + Environment.NewLine);
File.AppendAllText(filename, "}" + Environment.NewLine); File.AppendAllText(filename, "}" + Environment.NewLine);
} }

View file

@ -17,6 +17,7 @@ namespace WindowsFormsApplication1
int nomerPersa = 0; int nomerPersa = 0;
int pNomer = 0; int pNomer = 0;
PictureBox[] pic1 = new PictureBox[1000]; PictureBox[] pic1 = new PictureBox[1000];
String adressBackground = "";
public MainForm() public MainForm()
{ {
@ -212,6 +213,7 @@ namespace WindowsFormsApplication1
if (openFileDialog1.ShowDialog() == DialogResult.Cancel) if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return; return;
PictureBoxBackground.Image = Image.FromFile(openFileDialog1.FileName); PictureBoxBackground.Image = Image.FromFile(openFileDialog1.FileName);
adressBackground = openFileDialog1.FileName;
} }
private void SaveMultButton_Click(object sender, EventArgs e) private void SaveMultButton_Click(object sender, EventArgs e)
@ -228,9 +230,10 @@ namespace WindowsFormsApplication1
{ {
Directory.CreateDirectory(adres_papki); Directory.CreateDirectory(adres_papki);
} }
File.Copy(adressBackground, adres_papki + "\\" + Path.GetFileName(adressBackground), true);
Files.CreateStruct(filename); Files.CreateStruct(filename);
Files.OpenMain(filename, PictureBoxBackground); Files.OpenMain(filename, PictureBoxBackground, adressBackground);
for (int nomer = 0; nomer < nomerPersa; nomer++) for (int nomer = 0; nomer < nomerPersa; nomer++)
{ {