—мусор и вынос функций

This commit is contained in:
AnfimovS 2018-03-20 17:09:39 +04:00 committed by GitHub
parent 65fe8cbf46
commit fd04e8ad56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 163 additions and 369 deletions

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
namespace WindowsFormsApplication1
{
public class Files
{
public static void Beginning(string filename)
{
File.WriteAllText(filename, "");
File.AppendAllText(filename, "#include \"TXLib.h\"" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "struct Person" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, "double x;" + Environment.NewLine);
File.AppendAllText(filename, "double y;" + Environment.NewLine);
File.AppendAllText(filename, "double angle;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra;" + Environment.NewLine);
File.AppendAllText(filename, "HDC texture;" + Environment.NewLine);
File.AppendAllText(filename, " int MID_x;" + Environment.NewLine);
File.AppendAllText(filename, " int MID_y;" + Environment.NewLine);
File.AppendAllText(filename, " int rad;" + Environment.NewLine);
File.AppendAllText(filename, " int skorost;" + Environment.NewLine);
File.AppendAllText(filename, " int gr_dvigx;" + Environment.NewLine);
File.AppendAllText(filename, "int gr_dvigy;" + Environment.NewLine);
File.AppendAllText(filename, "int nach_dv;" + Environment.NewLine);
File.AppendAllText(filename, "int ampl_y;" + Environment.NewLine);
File.AppendAllText(filename, " int ampl_x;" + Environment.NewLine);
File.AppendAllText(filename, "double BeginTime;" + Environment.NewLine);
File.AppendAllText(filename, "double EndTime;" + Environment.NewLine);
File.AppendAllText(filename, "double Time;" + Environment.NewLine);
File.AppendAllText(filename, "};" + Environment.NewLine);
File.AppendAllText(filename, "int main()" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txCreateWindow(800, 600);" + Environment.NewLine);
}
public static void Ending(string filename)
{
File.AppendAllText(filename, " return 0;" + Environment.NewLine);
File.AppendAllText(filename, "}" + Environment.NewLine);
}
}
}

View file

@ -78,7 +78,6 @@
this.ButtonAddChar = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.textBox1 = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit();
this.panel2.SuspendLayout();
@ -94,7 +93,7 @@
this.LabelData.Size = new System.Drawing.Size(224, 23);
this.LabelData.TabIndex = 0;
this.LabelData.Text = "Данные о мултфильме:";
this.LabelData.Click += new System.EventHandler(this.label1_Click);
//this.LabelData.Click += new System.EventHandler(this.label1_Click);
//
// LabelLengh
//
@ -113,7 +112,7 @@
this.LabelName.Size = new System.Drawing.Size(60, 13);
this.LabelName.TabIndex = 2;
this.LabelName.Text = "Название:";
this.LabelName.Click += new System.EventHandler(this.label3_Click);
//this.LabelName.Click += new System.EventHandler(this.label3_Click);
//
// nazvanieTextBox
//
@ -121,6 +120,7 @@
this.nazvanieTextBox.Name = "nazvanieTextBox";
this.nazvanieTextBox.Size = new System.Drawing.Size(138, 20);
this.nazvanieTextBox.TabIndex = 3;
//this.nazvanieTextBox.TextChanged += new System.EventHandler(this.nazvanieTextBox_TextChanged);
//
// panel1
//
@ -153,7 +153,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(282, 527);
this.panel1.Size = new System.Drawing.Size(282, 380);
this.panel1.TabIndex = 4;
//
// label13
@ -200,7 +200,7 @@
this.label9.Size = new System.Drawing.Size(13, 13);
this.label9.TabIndex = 21;
this.label9.Text = "1";
this.label9.Click += new System.EventHandler(this.label7_Click);
//this.label9.Click += new System.EventHandler(this.label7_Click);
//
// label8
//
@ -210,7 +210,7 @@
this.label8.Size = new System.Drawing.Size(13, 13);
this.label8.TabIndex = 21;
this.label8.Text = "2";
this.label8.Click += new System.EventHandler(this.label7_Click);
//this.label8.Click += new System.EventHandler(this.label7_Click);
//
// label7
//
@ -220,7 +220,7 @@
this.label7.Size = new System.Drawing.Size(13, 13);
this.label7.TabIndex = 21;
this.label7.Text = "3";
this.label7.Click += new System.EventHandler(this.label7_Click);
//this.label7.Click += new System.EventHandler(this.label7_Click);
//
// label6
//
@ -248,7 +248,7 @@
this.label5.Size = new System.Drawing.Size(49, 13);
this.label5.TabIndex = 18;
this.label5.Text = "Котенок";
this.label5.Click += new System.EventHandler(this.label1_Click_1);
//this.label5.Click += new System.EventHandler(this.label1_Click_1);
//
// label3
//
@ -267,7 +267,7 @@
this.label2.Size = new System.Drawing.Size(49, 13);
this.label2.TabIndex = 18;
this.label2.Text = "Котенок";
this.label2.Click += new System.EventHandler(this.label1_Click_1);
//this.label2.Click += new System.EventHandler(this.label1_Click_1);
//
// button4
//
@ -289,13 +289,12 @@
//
// button2
//
this.button2.Location = new System.Drawing.Point(188, 320);
this.button2.Location = new System.Drawing.Point(188, 319);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(26, 17);
this.button2.Size = new System.Drawing.Size(26, 18);
this.button2.TabIndex = 19;
this.button2.Text = "X";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
//
@ -305,7 +304,7 @@
this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 18;
this.label1.Text = "Котенок";
this.label1.Click += new System.EventHandler(this.label1_Click_1);
//this.label1.Click += new System.EventHandler(this.label1_Click_1);
//
// button6
//
@ -365,7 +364,7 @@
//
this.splitter1.Location = new System.Drawing.Point(282, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(3, 527);
this.splitter1.Size = new System.Drawing.Size(3, 380);
this.splitter1.TabIndex = 5;
this.splitter1.TabStop = false;
//
@ -378,13 +377,13 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(285, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(392, 527);
this.panel2.Size = new System.Drawing.Size(392, 380);
this.panel2.TabIndex = 6;
//
// SaveCharButton
//
this.SaveCharButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.SaveCharButton.Location = new System.Drawing.Point(0, 467);
this.SaveCharButton.Location = new System.Drawing.Point(0, 320);
this.SaveCharButton.Name = "SaveCharButton";
this.SaveCharButton.Size = new System.Drawing.Size(392, 30);
this.SaveCharButton.TabIndex = 3;
@ -394,7 +393,6 @@
//
// panel3
//
this.panel3.Controls.Add(this.textBox1);
this.panel3.Controls.Add(this.SpriteNumberLabel);
this.panel3.Controls.Add(this.SpriteNumberTextBox);
this.panel3.Controls.Add(this.OpenButton);
@ -413,7 +411,7 @@
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 26);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(392, 471);
this.panel3.Size = new System.Drawing.Size(392, 324);
this.panel3.TabIndex = 2;
this.panel3.Visible = false;
//
@ -425,7 +423,7 @@
this.SpriteNumberLabel.Size = new System.Drawing.Size(119, 13);
this.SpriteNumberLabel.TabIndex = 16;
this.SpriteNumberLabel.Text = "Количество спрайтов:";
this.SpriteNumberLabel.Click += new System.EventHandler(this.label13_Click_1);
//this.SpriteNumberLabel.Click += new System.EventHandler(this.label13_Click_1);
//
// SpriteNumberTextBox
//
@ -452,7 +450,7 @@
this.AddPictureButton.TabIndex = 13;
this.AddPictureButton.Text = "Добавить";
this.AddPictureButton.UseVisualStyleBackColor = true;
this.AddPictureButton.Click += new System.EventHandler(this.button4_Click);
//this.AddPictureButton.Click += new System.EventHandler(this.button4_Click);
//
// LabelPic
//
@ -480,7 +478,7 @@
this.LabelDef2.Size = new System.Drawing.Size(13, 13);
this.LabelDef2.TabIndex = 10;
this.LabelDef2.Text = "--";
this.LabelDef2.Click += new System.EventHandler(this.label10_Click);
//this.LabelDef2.Click += new System.EventHandler(this.label10_Click);
//
// LabelDef1
//
@ -490,7 +488,7 @@
this.LabelDef1.Size = new System.Drawing.Size(13, 13);
this.LabelDef1.TabIndex = 9;
this.LabelDef1.Text = "--";
this.LabelDef1.Click += new System.EventHandler(this.label9_Click);
//this.LabelDef1.Click += new System.EventHandler(this.label9_Click);
//
// LabelWalls
//
@ -500,7 +498,7 @@
this.LabelWalls.Size = new System.Drawing.Size(107, 13);
this.LabelWalls.TabIndex = 8;
this.LabelWalls.Text = "Границы движения:";
this.LabelWalls.Click += new System.EventHandler(this.label8_Click);
//this.LabelWalls.Click += new System.EventHandler(this.label8_Click);
//
// TextBoxTime1
//
@ -515,7 +513,7 @@
this.TextBoxTime2.Name = "TextBoxTime2";
this.TextBoxTime2.Size = new System.Drawing.Size(100, 20);
this.TextBoxTime2.TabIndex = 4;
this.TextBoxTime2.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
//this.TextBoxTime2.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
//
// TextBoxWall2
//
@ -523,7 +521,7 @@
this.TextBoxWall2.Name = "TextBoxWall2";
this.TextBoxWall2.Size = new System.Drawing.Size(100, 20);
this.TextBoxWall2.TabIndex = 3;
this.TextBoxWall2.TextChanged += new System.EventHandler(this.TextBoxWall2_TextChanged);
//this.TextBoxWall2.TextChanged += new System.EventHandler(this.TextBoxWall2_TextChanged);
//
// TextBoxWall1
//
@ -531,7 +529,6 @@
this.TextBoxWall1.Name = "TextBoxWall1";
this.TextBoxWall1.Size = new System.Drawing.Size(100, 20);
this.TextBoxWall1.TabIndex = 2;
this.TextBoxWall1.TextChanged += new System.EventHandler(this.TextBoxWall1_TextChanged);
//
// ComboBoxMove
//
@ -559,7 +556,7 @@
// SaveMultButton
//
this.SaveMultButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.SaveMultButton.Location = new System.Drawing.Point(0, 497);
this.SaveMultButton.Location = new System.Drawing.Point(0, 350);
this.SaveMultButton.Name = "SaveMultButton";
this.SaveMultButton.Size = new System.Drawing.Size(392, 30);
this.SaveMultButton.TabIndex = 1;
@ -581,26 +578,18 @@
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(132, 114);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(235, 20);
this.textBox1.TabIndex = 17;
this.textBox1.Text = "Здесь должна быть кнопка амплитуды X Y !!!";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(677, 527);
this.ClientSize = new System.Drawing.Size(677, 380);
this.Controls.Add(this.panel2);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel1);
this.Name = "MainForm";
this.RightToLeftLayout = true;
this.Text = "Свойства персонажа";
this.Load += new System.EventHandler(this.Form1_Load);
//this.Load += new System.EventHandler(this.Form1_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).EndInit();
@ -663,7 +652,6 @@
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.TextBox textBox1;
}
}

View file

@ -18,14 +18,6 @@ namespace WindowsFormsApplication1
public partial class MainForm : Form
{
int yPersa = 300;
int nomerPersa = 0;
public Label[] l1 = new Label[100];
public Label[] l2 = new Label[100];
public Label[] l3 = new Label[100];
public Button[] b1 = new Button[100];
public Button[] b2 = new Button[100];
PictureBox[] pic1 = new PictureBox[1000];
@ -33,36 +25,8 @@ namespace WindowsFormsApplication1
{
InitializeComponent();
openFileDialog1.Filter = "Kartinki|*.bmp";
saveFileDialog1.Filter = "cpp files|*.cpp";
}
private void Form1_Load(object sender, EventArgs e)
{
/*int i=0;
for (; i < 10; i++)
{
PictureBox pic2 = new PictureBox();
pic2.Location = new Point(pic2.Location.X + (i*100), pic2.Location.Y);
pic2.BorderStyle = BorderStyle.FixedSingle;
pic1[i] = pic2;
Controls.Add(pic1[i]);
}*/
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
openFileDialog1.Filter = "Text files(*OpenFileDialog.txt)|*.txt|All files(*.*)|*.*";
saveFileDialog1.Filter = "Text files(*SaveFileDialog.txt)|*.txt|All files(*.*)|*.*";
}
private void button1_Click(object sender, EventArgs e)
@ -70,145 +34,21 @@ namespace WindowsFormsApplication1
panel3.Visible = true;
}
private void label9_Click(object sender, EventArgs e)
{
}
private void label10_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
//Ñïèñîê âñåõ ôàéëîâ ïàïêè
//Ñîçäàåøü èç íèõ ìàññèâ (èëè ñïèñîê)
//Âûáèðàåøü ðàíäîìíûé íîìåð
//pictureBox1.Image = Image.FromFile("kartinka.jpg");
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void create_struct(string filename)
{
File.WriteAllText(filename, "");
File.AppendAllText(filename, "#include \"TXLib.h\"" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "struct Person" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, " double x;" + Environment.NewLine);
File.AppendAllText(filename, " double y;" + Environment.NewLine);
File.AppendAllText(filename, " double angle;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra;" + Environment.NewLine);
File.AppendAllText(filename, " HDC texture;" + Environment.NewLine);
File.AppendAllText(filename, " int MID_x;" + Environment.NewLine);
File.AppendAllText(filename, " int MID_y;" + Environment.NewLine);
File.AppendAllText(filename, " int rad;" + Environment.NewLine);
File.AppendAllText(filename, " int skorost;" + Environment.NewLine);
File.AppendAllText(filename, " int gr_dvigx;" + Environment.NewLine);
File.AppendAllText(filename, " int gr_dvigy;" + Environment.NewLine);
File.AppendAllText(filename, " int nach_dv;" + Environment.NewLine);
File.AppendAllText(filename, " int ampl_y;" + Environment.NewLine);
File.AppendAllText(filename, " int ampl_x;" + Environment.NewLine);
File.AppendAllText(filename, " double BeginTime;" + Environment.NewLine);
File.AppendAllText(filename, " double EndTime;" + Environment.NewLine);
File.AppendAllText(filename, " double Time;" + Environment.NewLine);
File.AppendAllText(filename, "};" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "int main()" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, " txCreateWindow(" +
PictureBoxBackground.Image.Width.ToString() + ", " +
PictureBoxBackground.Image.Height.ToString() + ");" + Environment.NewLine);
}
private void open_while(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE));" + Environment.NewLine);
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);
}
private void close_while(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " txSleep(10);" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
}
private void delete_pics(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " txDeleteDC(per.texture);" + Environment.NewLine);
}
private void file_forser(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txSetColor(TX_WHITE);" + Environment.NewLine);
File.AppendAllText(filename, "txSetFillColor(TX_WHITE);" + Environment.NewLine);
File.AppendAllText(filename, "txRectangle(0, 0, 800, 600);" + Environment.NewLine);
File.AppendAllText(filename, "HDC texture = txLoadImage(\"Pictures\\Personaj.bmp\");" + Environment.NewLine);
}
private void file_ending(string filename)
{
File.AppendAllText(filename, "return " + SpriteNumberTextBox.Text + "0;" + Environment.NewLine);
File.AppendAllText(filename, "}" + Environment.NewLine);
}
private void SaveCharButtonClick(object sender, EventArgs e)
{
if (PictureBoxBackground.Image == null)
{
return;
}
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
{
string filename = saveFileDialog1.FileName;
//main.cpp
create_struct(filename);
//filename.Replace("Âàñÿ ÍÅ", "Ëîõ")
Files.Beginning(filename);
Sinus.CreatePerson(filename);
open_while(filename);
Sinus.sinus3(filename);
Sinus.sinus4(filename);
//sinus(filename);
Files.Ending(filename);
if (ComboBoxMove.Text == "Прямо")
{
sinus_create_person(filename);
old_place (filename);
open_while(filename);
go_pryamo(filename);
close_while(filename);
delete_pics(filename);
}
else if (ComboBoxMove.Text == "Волнами")
{
sinus_create_person(filename);
open_while(filename);
sinus3(filename);
close_while(filename);
delete_pics(filename);
}
else if (ComboBoxMove.Text == "Кругами")
{
circle_create_person(filename);
open_while(filename);
circle(filename);
close_while(filename);
delete_pics(filename);
}
file_ending(filename);
//Add TXLib and pics
File.Copy("TXLib.h", filename.Replace(Path.GetFileName(filename), "TXLib.h"), true);
string adres_papki = filename.Replace(Path.GetFileName(filename), "Pictures");
if (!Directory.Exists(adres_papki))
@ -217,38 +57,25 @@ namespace WindowsFormsApplication1
}
File.Copy("kartinka.jpg", adres_papki + "\\Personaj.bmp", true);
MessageBox.Show("Complete");
MessageBox.Show("Ôàéë ñîõðàíåí");
}
}
private void sinus_create_person(string filename)
private void open_while(string filename)
{
File.AppendAllText(filename, " Person per;" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " per.texture = txLoadImage(\"Pictures\\Personaj.bmp\");" + Environment.NewLine);
File.AppendAllText(filename, " per.x = " + TextBoxWall1.Text + ";" + Environment.NewLine);
File.AppendAllText(filename, " per.y = " + TextBoxWall1.Text + ";" + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " per.nach_dv = per.y;" + Environment.NewLine);
File.AppendAllText(filename, " per.ampl_y = 150;" + Environment.NewLine);
File.AppendAllText(filename, " per.ampl_x = 10;" + Environment.NewLine);
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE));" + Environment.NewLine);
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);
}
private void sinus3(string filename)
private void circle(string filename)
{
File.AppendAllText(filename, " per.x++;" + Environment.NewLine);
File.AppendAllText(filename, " per.y = per.nach_dv + per.ampl_y * sin(per.x / per.ampl_x);" + Environment.NewLine);
File.AppendAllText(filename, " txTransparentBlt(txDC(), per.x, per.y, 55, 86, per.texture, 55 * per.nomer_kadra, 0, RGB(0, 255, 255));" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra++;" + Environment.NewLine);
File.AppendAllText(filename, " if (per.nomer_kadra > " + SpriteNumberTextBox.Text + ")" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
}
private void circle_create_person(string filename)
{
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txCreateWindow(800, 600);"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\Personaj.bmp);" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " double textureX = 50;"+ Environment.NewLine);
@ -256,35 +83,12 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, " double angle = 0;"+ Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra = 0;"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
}
private void old_place(string filename)
{
File.AppendAllText(filename, " per.x = 10; " + Environment.NewLine);
File.AppendAllText(filename, " per.y = 10; " + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0; " + Environment.NewLine);
File.AppendAllText(filename, " per.gr_dvigx = 1000; " + Environment.NewLine);
}
private void go_pryamo(string filename)
{
File.AppendAllText(filename, "txTransparentBlt(txDC(), per.x, per.y, 55, 86, per.texture, 55 * per.nomer_kadra, 0, RGB(0, 255, 255)); " + Environment.NewLine);
File.AppendAllText(filename, " per.x++; " + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra++;" + Environment.NewLine);
File.AppendAllText(filename, " if (per.nomer_kadra > 2) " + Environment.NewLine);
File.AppendAllText(filename, " { " + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, " " + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
}
private void circle(string filename)
{
File.AppendAllText(filename, " while (!GetAsyncKeyState(VK_ESCAPE))"+ Environment.NewLine);
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, Environment.NewLine);
File.AppendAllText(filename, " angle++;"+ Environment.NewLine);
File.AppendAllText(filename, " textureX = 500 + 200 * cos (angle / 10);"+ Environment.NewLine);
File.AppendAllText(filename, " textureY = 300 + 200 * sin (angle / 10);"+ Environment.NewLine);
@ -297,11 +101,15 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, " nomer_kadra = 0;"+ Environment.NewLine);
File.AppendAllText(filename, " }"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " txSleep(10);"+ Environment.NewLine);
File.AppendAllText(filename, " }"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(texture);"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "return 0;"+ Environment.NewLine);
File.AppendAllText(filename, "}"+ Environment.NewLine);
}
private void button5_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
@ -312,115 +120,20 @@ namespace WindowsFormsApplication1
MessageBox.Show("Ôàéë îòêðûò");
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void label8_Click(object sender, EventArgs e)
{
}
private void label13_Click(object sender, EventArgs e)
{
}
private void label13_Click_1(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return;
string filename = openFileDialog1.FileName;
string fileText = File.ReadAllText(filename);
string fileText =File.ReadAllText(filename);
nazvanieTextBox.Text = fileText;
//MessageBox.Show("Ôàéë îòêðûò");
PictureBoxBackground.Image = Image.FromFile("kartinka.jpg");
MessageBox.Show(PictureBoxBackground.Image.Width.ToString());
}
private void button1_Click_1(object sender, EventArgs e)
{
Close();
}
private void TextBoxWall2_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label1_Click_1(object sender, EventArgs e)
{
}
private void label7_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
l1[0] = new Label();
l1[0].Top = yPersa;
l1[0].Left = 30;
l1[0].Width = 20;
l1[0].Visible = true;
l1[0].Text = "1";
this.panel1.Controls.Add(l1[0]);
l2[0] = new Label();
l2[0].Top = yPersa;
l2[0].Left = 60;
l2[0].Width = 60;
l2[0].Visible = true;
l2[0].Text = "Перс1";
this.panel1.Controls.Add(l2[0]);
l3[0] = new Label();
l3[0].Top = yPersa;
l3[0].Left = 120;
l3[0].Width = 40;
l3[0].Visible = true;
l3[0].Text = "ocphcghfgh";
this.panel1.Controls.Add(l3[0]);
b1[0] = new Button();
b1[0].Top = yPersa;
b1[0].Left = 170;
b1[0].Width = 50;
b1[0].Visible = true;
b1[0].Text = "R";
this.panel1.Controls.Add(b1[0]);
b2[0] = new Button();
b2[0].Top = yPersa;
b2[0].Left = 230;
b2[0].Width = 50;
b2[0].Visible = true;
b2[0].Text = "X";
this.panel1.Controls.Add(b2[0]);
yPersa = yPersa + 30;
}
private void button3_Click(object sender, EventArgs e)
{
}
private void TextBoxWall1_TextChanged(object sender, EventArgs e)
{
}
}
}

View file

@ -124,6 +124,6 @@
<value>153, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>39</value>
</metadata>
</root>

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
public class Sinus
{
public static void CreatePerson(string filename)
{
File.AppendAllText(filename, " Person per;" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " per.texture = txLoadImage(\"Pictures\\Personaj.bmp\");" + Environment.NewLine);
File.AppendAllText(filename, " per.x = 50;" + Environment.NewLine);
File.AppendAllText(filename, " per.y = 50;" + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " per.nach_dv = 300;" + Environment.NewLine);
File.AppendAllText(filename, " per.ampl_y = 150;" + Environment.NewLine);
File.AppendAllText(filename, " per.ampl_x = 10;" + Environment.NewLine);
}
public static void sinus3(string filename)
{
File.AppendAllText(filename, " per.x++;" + Environment.NewLine);
File.AppendAllText(filename, " per.y = per.nach_dv + per.ampl_y * sin(per.x / per.ampl_x);" + Environment.NewLine);
File.AppendAllText(filename, " txTransparentBlt(txDC(), per.x, per.y, 55, 86, per.texture, 55 * per.nomer_kadra, 0, RGB(0, 255, 255));" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra++;" + Environment.NewLine);
File.AppendAllText(filename, " if (per.nomer_kadra > 2)" + Environment.NewLine);
File.AppendAllText(filename, " {" + Environment.NewLine);
File.AppendAllText(filename, " per.nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
}
public static void sinus4(string filename)
{
File.AppendAllText(filename, " txSleep(10);" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, "txDeleteDC(per.texture);" + Environment.NewLine);
}
}
}

View file

@ -9,9 +9,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindowsFormsApplication1</RootNamespace>
<AssemblyName>WindowsFormsApplication1</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -22,7 +21,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -32,7 +30,6 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -48,6 +45,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Files.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -56,6 +54,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sinus.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@ -67,9 +66,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>