public Image Draw(Graphics graphics, Point point, ScreenDimensions wnd, bool flag = false) { if (flag == true) { return(Game_Class.generate_pic_field(graphics, wnd)); } else { if ((wnd.width > 0) && (wnd.height > 0)) { Image temp = new Bitmap(wnd.width * this.Block_Width, wnd.height * this.Block_Height); Graphics g = Graphics.FromImage(temp); for (int rows = wnd.top; rows < wnd.top + wnd.height; rows++) { for (int columns = wnd.bottom; columns < wnd.bottom + wnd.width; columns++) { if (tiles_array[columns + rows * tile_size]) { obj.Draw(g, new System.Drawing.Point(this.Block_Width * (columns - wnd.bottom), this.Block_Height * (rows - wnd.top)), imageType(Shape)); } } } graphics.DrawImage(temp, new PointF(this.Block_Width * (point.x + wnd.bottom - wnd.bottom), this.Block_Height * (point.y + wnd.top - wnd.top))); g.Dispose(); temp.Dispose(); } return(null); } }
private void Form1_Load(object sender, System.EventArgs e) { // initalize the width and height of the stage. game = new Game_Class(new ScreenDimensions(0, 0, picField.Width, picField.Height)); game.ProcessEvent += new Tetris.TetrisHandler(Tetris_Process); game.Block.Block_Width = 24; game.Block.Block_Height = 24; saveImage = new Bitmap(picField.Width, picField.Height); }