Example #1
0
        public void Draw(ref Graphics g, StageMap stageMap)
        {
            if (tileInfo != null)
            {
                int yAdjust =
                    stageMap.TileHeight - tileInfo.tileImage.Height - stageMap.TileHeight / 2;



                g.DrawImage(tileInfo.tileImage,
                            stageMap.TileWidth * (indexX + indexY) / 2,
                            stageMap.TileHeight * (-indexX + indexY) / 2 + stageMap.GetHeight() / 2 + yAdjust);
            }
        }
Example #2
0
        private void mapPictureBox_Paint(object sender, PaintEventArgs e)
        {
            BufferedGraphicsContext currentContext;
            BufferedGraphics        myBuffer;

            currentContext = BufferedGraphicsManager.Current;
            myBuffer       = currentContext.Allocate(e.Graphics, e.ClipRectangle);

            myBuffer.Graphics.Clear(Form.DefaultBackColor);

            if (map != null)
            {
                myBuffer.Graphics.Clear(Color.White);
                mapPictureBox.Width  = map.GetWidth();
                mapPictureBox.Height = map.GetHeight();
                map.Draw(myBuffer.Graphics, tileListBox);
            }

            myBuffer.Render();
            myBuffer.Render(e.Graphics);
            myBuffer.Dispose();
        }