Example #1
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            if (!fileLoaded)
            {
                return;
            }
            var g = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            bool renderPhysics = isPhysicsLayerSelected();

            var renderParams = new MapEditor.RenderParams
            {
                bigBlocks       = bigBlocks,
                visibleRect     = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen),
                curScale        = curScale,
                showBlocksAxis  = showAxis,
                renderBlockFunc = renderPhysics ? MapEditor.renderPhysicsOnPanelFunc : MapEditor.renderBlocksOnPanelFunc
            };

            int blocksCount = renderPhysics ? ConfigScript.getPhysicsBlocksCount() : bigBlocks.Length; //hardcode physics blocks count

            MapEditor.renderAllBlocks(g, blocksScreen, curActiveBlock, blocksCount, renderParams);
        }
Example #2
0
        private void paintBack(Graphics g)
        {
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            int blockWidth  = formMain.Layers[0].blockWidth;
            int blockHeight = formMain.Layers[0].blockHeight;
            int scrLevelNo  = getLevelRecForGameType().levelNo;

            int width     = ConfigScript.getScreenWidth(scrLevelNo);
            int height    = ConfigScript.getScreenHeight(scrLevelNo);
            int scrWidth  = (int)(width * blockWidth * curScale);
            int scrHeight = (int)(height * blockHeight * curScale);

            for (int x = 0; x < curLevelLayerData.width; x++)
            {
                for (int y = 0; y < curLevelLayerData.height; y++)
                {
                    int noInLayout = y * curLevelLayerData.width + x;
                    int scrNo      = calcScrNo(noInLayout);
                    if (scrNo < formMain.Layers[0].screens.Length && scrNo >= 0)
                    {
                        var visibleRect = UtilsGui.getVisibleRectangle(pnView, mapScreen);
                        int leftMargin  = scrWidth * x;
                        int topMargin   = scrHeight * y;
                        MapEditor.Render(g, bigBlocks, visibleRect, formMain.Layers, scrNo, curScale, false, formMain.ShowAxis, leftMargin, topMargin, width, height);
                        //ConfigScript.renderToMainScreen(g, (int)curScale);
                    }
                    else
                    {
                        //g.FillRectangle(Brushes.Black, new Rectangle(0, 0, 512, 512));
                    }
                }
            }
        }
Example #3
0
        private void mapScreen_Paint(object sender, PaintEventArgs e)
        {
            var g = e.Graphics;

            if (curTileStruct == null)
            {
                g.Clear(Color.Black);
                return;
            }
            var visibleRect = UtilsGui.getVisibleRectangle(this, mapScreen);

            g.Clear(Color.Black);
            var blockLayer = new BlockLayer(curTileStruct.toArray());

            blockLayer.showLayer = true;
            var screens = new[] { new Screen(blockLayer, curTileStruct.width, curTileStruct.height) };

            MapEditor.render(g, screens, 0, new MapEditor.RenderParams
            {
                bigBlocks               = bigBlocks,
                visibleRect             = visibleRect,
                curScale                = 2.0f,
                showBlocksAxis          = formMain.showAxis,
                showBorder              = false,
                width                   = curTileStruct.width,
                height                  = curTileStruct.height,
                additionalRenderEnabled = false,
            });
        }
Example #4
0
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (!fileLoaded)
            {
                return;
            }
            int[] indexes  = layers[0].screens[curActiveScreen];
            int[] indexes2 = (ConfigScript.getLayersCount() > 1) ? layers[1].screens[curActiveScreen] : null;
            var   g        = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            int WIDTH       = ConfigScript.getScreenWidth(curActiveLevelForScreen);
            int HEIGHT      = ConfigScript.getScreenHeight(curActiveLevelForScreen);
            int TILE_SIZE_X = (int)(layers[0].blockWidth * curScale);
            int TILE_SIZE_Y = (int)(layers[0].blockHeight * curScale);
            int SIZE        = WIDTH * HEIGHT;
            var visibleRect = UtilsGui.getVisibleRectangle(pnView, mapScreen);

            //ConfigScript.getScreenVertical() ? TILE_SIZE_Y : TILE_SIZE_X
            MapEditor.Render(e.Graphics, bigBlocks, visibleRect, layers, curActiveScreen, curScale, true, showAxis, ConfigScript.getScreenVertical() ? 0 : TILE_SIZE_X, ConfigScript.getScreenVertical() ? TILE_SIZE_X : 0, WIDTH, HEIGHT);

            if (!ConfigScript.getScreenVertical() && showNeiScreens && (curActiveScreen > 0) && layers[0].showLayer)
            {
                renderNeighbornLine(g, curActiveScreen - 1, (WIDTH - 1), 0);
            }
            if (!ConfigScript.getScreenVertical() && showNeiScreens && (curActiveScreen < ConfigScript.screensOffset[curActiveLevelForScreen].recCount - 1) && layers[0].showLayer)
            {
                renderNeighbornLine(g, curActiveScreen + 1, 0, (WIDTH + 1) * TILE_SIZE_X);
            }

            //show brush
            bool altPressed = Control.ModifierKeys == Keys.Alt;

            if (showBrush && curActiveBlock != -1 && (curDx != OUTSIDE || curDy != OUTSIDE) && !altPressed)
            {
                if (!useStructs)
                {
                    var tx       = ConfigScript.getScreenVertical() ? curDy * TILE_SIZE_X : (curDx + 1) * TILE_SIZE_X;
                    var ty       = ConfigScript.getScreenVertical() ? (curDx + 1) * TILE_SIZE_Y : curDy * TILE_SIZE_Y;
                    var tileRect = new Rectangle(tx, ty, TILE_SIZE_X, TILE_SIZE_Y);
                    g.DrawImage(bigBlocks[curActiveBlock], tileRect);
                }
                else
                {
                    drawActiveTileStruct(g, visibleRect);
                }
            }
            if (altPressed && selectionRect)
            {
                int x = Math.Min(selectionMouseX, selectionBeginMouseX);
                int y = Math.Min(selectionMouseY, selectionBeginMouseY);
                int w = Math.Abs(selectionMouseX - selectionBeginMouseX);
                int h = Math.Abs(selectionMouseY - selectionBeginMouseY);
                g.DrawRectangle(new Pen(Brushes.Black, 2.0f), new Rectangle(x, y, w, h));
            }
        }
Example #5
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            var visibleRect = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen);
            var sb0         = smallBlocksImages[0];
            int sbw         = sb0[0].Width;
            int sbh         = sb0[0].Height;

            MapEditor.RenderAllBlocks(e.Graphics, blocksScreen, smallBlocksImages[0], sbw, sbh, visibleRect, 1.0f, curActiveBlock, false);
        }
Example #6
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            var visibleRect = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen);
            var g           = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            MapEditor.RenderAllBlocks(g, blocksScreen, bigBlocks, blockWidth, blockHeight, visibleRect, 1.0f, curActiveTile, showAxis);
        }
Example #7
0
        private void paintBack(Graphics g)
        {
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            var screen      = getActiveScreen();
            int blockWidth  = bigBlocks[0].Width;
            int blockHeight = bigBlocks[0].Height;

            int width     = screen.width;
            int height    = screen.height;
            int scrWidth  = (int)(width * blockWidth * curScale);
            int scrHeight = (int)(height * blockHeight * curScale);

            int tileSizeX = (int)(bigBlocks[0].Width * curScale);
            int tileSizeY = (int)(bigBlocks[0].Height * curScale);

            for (int x = 0; x < curLevelLayerData.width; x++)
            {
                for (int y = 0; y < curLevelLayerData.height; y++)
                {
                    int noInLayout = y * curLevelLayerData.width + x;
                    int scrNo      = calcScrNo(noInLayout);
                    if (scrNo < screens.Length && scrNo >= 0)
                    {
                        var visibleRect = UtilsGui.getVisibleRectangle(pnView, mapScreen);

                        int leftMargin = scrWidth * x;
                        int topMargin  = scrHeight * y;

                        MapEditor.render(g, screens, scrNo, new MapEditor.RenderParams
                        {
                            bigBlocks               = bigBlocks,
                            visibleRect             = visibleRect,
                            curScale                = curScale,
                            showBlocksAxis          = showAxis,
                            width                   = width,
                            height                  = height,
                            additionalRenderEnabled = formMain.additionalRenderEnabled,
                            leftMargin              = leftMargin,
                            topMargin               = topMargin
                        });

                        if (showScreenAxis)
                        {
                            g.DrawRectangle(new Pen(Brushes.Black, 2.0f), new Rectangle(leftMargin, topMargin, tileSizeX * width, tileSizeY * height));
                        }
                    }
                    else
                    {
                        //g.FillRectangle(Brushes.Black, new Rectangle(0, 0, 512, 512));
                    }
                }
            }
        }
Example #8
0
 private void blocksScreen_Paint(object sender, PaintEventArgs e)
 {
     MapEditor.renderAllBlocks(e.Graphics, blocksScreen, curActiveBlock, smallBlocksImages[0].Length, new MapEditor.RenderParams
     {
         bigBlocks       = smallBlocksImages[0],
         visibleRect     = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen),
         curScale        = 1.0f,
         showBlocksAxis  = false,
         renderBlockFunc = MapEditor.renderBlocksOnPanelFunc
     });
 }
Example #9
0
 private void blocksScreen_Paint(object sender, PaintEventArgs e)
 {
     MapEditor.renderAllBlocks(e.Graphics, blocksScreen, curActiveBlock, bigBlocks.Length, new MapEditor.RenderParams
     {
         bigBlocks       = bigBlocks,
         visibleRect     = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen),
         curScale        = curScale,
         showBlocksAxis  = formMain.showAxis,
         renderBlockFunc = MapEditor.renderBlocksOnPanelFunc
     });
 }
Example #10
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            if (!fileLoaded)
            {
                return;
            }
            var g = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;
            var visibleRect = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen);

            MapEditor.RenderAllBlocks(e.Graphics, blocksScreen, bigBlocks, layers[0].blockWidth, layers[0].blockHeight, visibleRect, curScale, curActiveBlock, showAxis);
        }
Example #11
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            var g = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;
            MapEditor.renderAllBlocks(e.Graphics, blocksScreen, curActiveBlock, videos[curActiveSubpal].Length, new MapEditor.RenderParams
            {
                bigBlocks       = videos[curActiveSubpal],
                visibleRect     = UtilsGui.getVisibleRectangle(this, blocksScreen),
                curScale        = 1.0f,
                showBlocksAxis  = showAxis,
                renderBlockFunc = MapEditor.renderBlocksOnPanelFunc
            });
        }
Example #12
0
        private void mapScreen_Paint(object sender, PaintEventArgs e)
        {
            var g = e.Graphics;

            if (curTileStruct == null)
            {
                g.Clear(Color.Black);
                return;
            }
            var visibleRect = UtilsGui.getVisibleRectangle(this, mapScreen);

            g.Clear(Color.Black);
            var blockLayer = new BlockLayer()
            {
                screens = new int[1][] { curTileStruct.toArray() }, showLayer = true, blockWidth = 32, blockHeight = 32
            };

            MapEditor.Render(g, bigBlocks, visibleRect, new BlockLayer[] { blockLayer }, 0, 2.0f, false, formMain.ShowAxis, 0, 0, curTileStruct.Width, curTileStruct.Height);
        }
Example #13
0
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (!fileLoaded)
            {
                return;
            }
            var g = e.Graphics;

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            g.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.Half;

            var screen = getActiveScreen();

            int width       = screen.width;
            int height      = screen.height;
            int tileSizeX   = (int)(bigBlocks[0].Width * curScale);
            int tileSizeY   = (int)(bigBlocks[0].Height * curScale);
            var visibleRect = UtilsGui.getVisibleRectangle(pnView, mapScreen);

            MapEditor.render(e.Graphics, screens, screenNo, new MapEditor.RenderParams
            {
                bigBlocks               = bigBlocks,
                visibleRect             = visibleRect,
                curScale                = curScale,
                showBlocksAxis          = showAxis,
                showBorder              = true,
                width                   = width,
                height                  = height,
                additionalRenderEnabled = additionalRenderEnabled,
                leftMargin              = tileSizeX,
                topMargin               = 0
            });

            if (showNeiScreens && (screenNo > 0) && screen.layers[0].showLayer)
            {
                renderNeighbornLine(g, screenNo - 1, (width - 1), 0);
            }
            if (showNeiScreens && (screenNo < ConfigScript.screensOffset[0].recCount - 1) && screen.layers[0].showLayer)
            {
                renderNeighbornLine(g, screenNo + 1, 0, (width + 1) * tileSizeX);
            }

            //show brush
            bool altPressed = ModifierKeys == Keys.Alt;

            if (!isPhysicsLayerSelected()) //not show brush if physics editing
            {
                if (showBrush && curActiveBlock != -1 && (curDx != Outside || curDy != Outside) && !altPressed)
                {
                    if (!useStructs)
                    {
                        var tx       = (curDx + 1) * tileSizeX;
                        var ty       = curDy * tileSizeY;
                        var tileRect = new Rectangle(tx, ty, tileSizeX, tileSizeY);
                        g.DrawImage(bigBlocks[curActiveBlock], tileRect);
                    }
                    else
                    {
                        drawActiveTileStruct(g, visibleRect);
                    }
                }
            }

            if (altPressed && selectionRect)
            {
                int x = Math.Min(selectionMouseX, selectionBeginMouseX);
                int y = Math.Min(selectionMouseY, selectionBeginMouseY);
                int w = Math.Abs(selectionMouseX - selectionBeginMouseX);
                int h = Math.Abs(selectionMouseY - selectionBeginMouseY);
                g.DrawRectangle(new Pen(Brushes.Black, 2.0f), new Rectangle(x, y, w, h));
            }
        }
Example #14
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            var visibleRect = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen);

            MapEditor.RenderAllBlocks(e.Graphics, blocksScreen, bigBlocks, blockWidth, blockHeight, visibleRect, 1.0f, curActiveTile, false);
        }
Example #15
0
        private void blocksScreen_Paint(object sender, PaintEventArgs e)
        {
            var visibleRect = UtilsGui.getVisibleRectangle(pnBlocks, blocksScreen);

            MapEditor.RenderAllBlocks(e.Graphics, blocksScreen, bigBlocks, blockWidth, blockHeight, visibleRect, curScale, curActiveBlock, formMain.ShowAxis);
        }