Exemple #1
0
        public static void renderAllBlocks(Graphics g, PictureBox parentControl, int activeBlock, int renderBlocksCount, RenderParams renderParams)
        {
            int tileSizeX = renderParams.getTileSizeX();
            int tileSizeY = renderParams.getTileSizeY();
            int width     = parentControl.Width / tileSizeX;

            if (width == 0)
            {
                return;
            }

            for (int bigBlockNo = 0; bigBlockNo < renderBlocksCount; bigBlockNo++)
            {
                var tileRect = new Rectangle((bigBlockNo % width) * tileSizeX, bigBlockNo / width * tileSizeY, tileSizeX, tileSizeY);
                if (renderParams.needRenderTileRect(tileRect))
                {
                    renderParams.renderBlock(g, bigBlockNo, tileRect);

                    //additinal border render for active block
                    if (bigBlockNo == activeBlock)
                    {
                        g.DrawRectangle(new Pen(Brushes.Red, 3.0f), tileRect);
                    }
                }
            }
        }
Exemple #2
0
        private static void renderLayer(Graphics g, BlockLayer layer, RenderParams renderParams)
        {
            bool needRenderLayer = layer != null && layer.showLayer;

            if (!needRenderLayer)
            {
                return;
            }

            int tileSizeX = renderParams.getTileSizeX();
            int tileSizeY = renderParams.getTileSizeY();

            int size = renderParams.getLayerSize();

            for (int i = 0; i < size; i++)
            {
                int       bigBlockNo = ConfigScript.getBigTileNoFromScreen(layer.data, i);
                Rectangle tileRect   = new Rectangle((i % renderParams.width) * tileSizeX + renderParams.leftMargin, i / renderParams.width * tileSizeY + renderParams.topMargin, tileSizeX, tileSizeY);
                renderParams.renderBlock(g, bigBlockNo, tileRect);
            }
        }