private void Display_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(BlockColors.cGrid); // g.PageScale g.ScaleTransform(scale, scale); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; for (int x = 0; x < currentSim.X; x++) { for (int y = 0; y < currentSim.Y; y++) { //int ba = r.x / scale / 9; (i * 9 + 1) * scale < r.x + r.width; // g.PageScale Rectangle r = new Rectangle(x * 9 + 1, y * 9 + 1, 8, 8); BlockDrawSettings b = new BlockDrawSettings(currentSim.GetBlock(x, y, cZ)); if (b.Block.Type == eBlock.WIRE) { drawWire(g, r, x, y, cZ); } else { BlockImages.gDrawBlock(g, r, b); } } } }
void makeBar() { bar = new Bitmap((int)((sArray.Length * 9 + 1) * scale), (int)(scale * 10)); Graphics g = Graphics.FromImage(bar); g.Clear(BlockColors.cGrid); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.ScaleTransform(scale, scale); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; g.FillRectangle(BlockColors.bHilite, (selected * 9), 0, 10, 10); for (int i = 0; i < sArray.Length; i++) { Rectangle r = new Rectangle(i * 9 + 1, 1, 8, 8); BlockDrawSettings b; int j = 0; if (sArray[i][0].Type == eBlock.BLOCK) { if (sArray[i][1].Type == eBlock.BLOCK) { b = new BlockDrawSettings(sArray[i][2], WireMask.AllDir, true); b.Fog = true; } else { b = new BlockDrawSettings(sArray[i][1], WireMask.AllDir, true); } b.OnBlock = true; } else { b = new BlockDrawSettings(sArray[i][j], WireMask.AllDir, true); } if (sArray[i][2].Type == eBlock.BLOCK) { b.Fog = true; } BlockImages.gDrawBlock(g, r, b); } g.Dispose(); this.MinimumSize = bar.Size; this.MaximumSize = bar.Size; }
private void Display_Paint(object sender, PaintEventArgs e) { if (!stopPaint) { Graphics g = e.Graphics; g.Clear(BlockColors.cGrid); // g.PageScale g.ScaleTransform(scale, scale); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; for (int x = 0; x < currentSim.X; x++) { for (int y = 0; y < currentSim.Y; y++) { BlockDrawSettings b; BlockVector v = new BlockVector(x, y, floor); if (currentSim[v].isBlock && (currentSim[v.Up].isWire || currentSim[v.Up].isPreasurePad || ((currentSim[v.Up].isTorch || currentSim[v.Up].isLeaver || currentSim[v.Up].isTorch) && currentSim[v.Up].Place == Direction.DOWN))) { v = v.Up; b = new BlockDrawSettings(currentSim[v]); b.OnBlock = true; } else { b = new BlockDrawSettings(currentSim[v]); } if (currentSim[v.Up].isBlock) { b.Fog = true; } Rectangle r = new Rectangle(x * 9 + 1, y * 9 + 1, 8, 8); BlockImages.gDrawBlock(g, r, b); } } } }
public Bitmap[] getFoorOneTiles() { // make them 50x50 BlockDrawSettings bd; Size s = new Size(10 * ConstScale, 10 * ConstScale); Point p = new Point(0, 0); Graphics g; Bitmap[] bArray = new Bitmap[selectArray.Length]; for (int i = 0; i < bArray.Length; i++) { bArray[i] = new Bitmap(s.Width, s.Height); g = setGraphics(bArray[i]); bd = new BlockDrawSettings(selectArray[i]); BlockImages.gDrawBlock(g, new Rectangle(p, s), bd); g.Dispose(); } return(bArray); }
public void drawWire(Graphics g, Rectangle r, int x, int y, int z) { WireMask m = WireMask.None; if (currentSim.canConnect(x, y, x - 1, y, z)) { m |= WireMask.West; } if (currentSim.canConnect(x, y, x + 1, y, z)) { m |= WireMask.East; } if (currentSim.canConnect(x, y, x, y - 1, z)) { m |= WireMask.North; } if (currentSim.canConnect(x, y, x, y + 1, z)) { m |= WireMask.South; } BlockImages.gDrawBlock(g, r, new BlockDrawSettings(currentSim.GetBlock(x, y, z), m)); }