Солуянова Семестровая Марио. Введение в ии
Скачать 0.58 Mb.
|
| | | | |||
| public void AddLine(ObjectType OT, int y) | | | |||
| { | | | |||
| for(int x = 0;x<40;x++) | | | |||
| list.Add(new MyObject(OT, MainGraphic, x*16, y)); | | | |||
| | | | |||
| } | | | |||
| | | | |||
| private void Form1_Load(object sender, EventArgs e) | | | |||
| { | | | |||
| list = new List | | | |||
| MainImage = new Bitmap(this.Width,this.Height); | | | |||
| MainGraphic = Graphics.FromImage(MainImage); | | | |||
| | | | |||
| AddLine(ObjectType.OT_MarioBig,0); | | | |||
| AddLine(ObjectType.OT_MarioFire,16); | | | |||
| AddLine(ObjectType.OT_MarioSmall,32); | | | |||
| AddLine(ObjectType.OT_Brick,48); | | | |||
| AddLine(ObjectType.OT_BlockQuestion,64); | | | |||
| AddLine(ObjectType.OT_Goomba,80); | | | |||
| AddLine(ObjectType.OT_Koopa,96); | | | |||
| AddLine(ObjectType.OT_Pirana, 112); | | | |||
| | | | |||
| | | | |||
| | | | |||
| } | | | |||
| | | | |||
| private void timer_Tick(object sender, EventArgs e) | | | |||
| { | | | |||
| Invalidate(); | | | |||
| } | | | |||
| | | | |||
| public void DrawAll(Graphics g) | | | |||
| { | | | |||
| | | | |||
| //MainGraphic.DrawImage(ImageGenerator.GetImage(ObjectType.OT_BG_Block), new Rectangle(0, 0, this.Width | | | |||
| // , this.Height), new Rectangle(0, 0, 1024, 400), GraphicsUnit.Pixel); | | | |||
| | | | |||
| | | | |||
| | | | |||
| // MainGraphic.DrawImage(pMain.Image, new Rectangle(0, 0, this.Width | | | |||
| // , this.Height), new Rectangle(0, 0, 1024, 400), GraphicsUnit.Pixel); | | | |||
| | | | |||
| foreach (MyObject o in list) | | | |||
| { | | | |||
| if (o.xGraph != g) | | | |||
| o.xGraph=g; | | | |||
| o.Draw(); | | | |||
| } | | | |||
| } | | | |||
| private void Form1_Paint(object sender,PaintEventArgs e) | | | |||
| { | | | |||
| Graphics xGraph = e.Graphics; | | | |||
| | | | |||
| //xGraph.DrawImage(ImageGenerator.GetImage(ObjectType.OT_BG_Block), new Rectangle(0, 0, this.Width | | | |||
| // , this.Height), new Rectangle(0, 0, 1024, 400), GraphicsUnit.Pixel); | | | |||
| xGraph.DrawImage(ImageGenerator.GetImage(ObjectType.OT_BG_Block),0,0); | | | |||
| | | | |||
| DrawAll(xGraph); | | | |||
| | | | |||
| //xGraph.DrawImage(MainImage,new Rectangle(0,0,this.Width,this.Height),new Rectangle(0,0,this.Width,this.Height),GraphicsUnit.Pixel); | | | |||
| |