如何快速展示Minecraft Schematic以获胜?

时间:2017-12-06 10:02:15

标签: c# winforms bitmap gdi+ minecraft

有我的代码,但绘图很慢:

        int BlockWidth = 16
        SourceBlueMap = new Bitmap(BlocksRect.Width, BlocksRect.Height);
        Graphics Gpi = Graphics.FromImage(SourceBlueMap);

        AlphaBlock block;

        string strPath = @"C:\Users\Administrator\Desktop\Blocks";

        BlockInfo blockinfo;


        for (int x = 0; x < iXDim; x++)
        {
            for (int y = 0; y < iYDim; y++)
            {
                for (int z = 0; z < iZDim; z++)
                {
                    block = Blocks.GetBlock(x, y, z);

                    rect.X = x * BlockWidth;
                    rect.Y = z * BlockWidth;

                    if (BlockInfoList.Exists(info =>
                        info.ID == block.ID && info.Data == block.Data))
                    {
                        blockinfo = BlockInfoList.Find(info =>
                        info.ID == block.ID && info.Data == block.Data);

                        if (File.Exists(strPath + "\\" + blockinfo.Name + ".png"))
                        {
                            using (Bitmap bmp = new Bitmap(strPath + "\\" + blockinfo.Name + ".png"))
                            {
                                Gpi.DrawImage(bmp, rect);
                            }
                        }
                    }  
                }
            }
        }

        Gpi.Dispose();

绘制256 * 256大小的地图需要6秒。

但其他程序使用平局超过1秒: http://www.diamondpants.com/spritecraft/PayPalDonate.aspx

0 个答案:

没有答案