public void Create(LogicImage li, int x0, int y0, int x1, int y1, Color32 color) { int dx = Mathf.Abs(x1 - x0), sx = x0 < x1 ? 1 : -1; int dy = Mathf.Abs(y1 - y0), sy = y0 < y1 ? 1 : -1; int err = (dx > dy ? dx : -dy) / 2, e2; for (; ;) { li.SetPixel(x0, y0, color); pointList.Add(new IntVector2D(x0, y0)); if (x0 == x1 && y0 == y1) { break; } e2 = err; if (e2 > -dx) { err -= dy; x0 += sx; } if (e2 < dy) { err += dx; y0 += sy; } } }
public ImageBase(LogicImage logicImage) { this.width = logicImage.width; this.height = logicImage.height; texture = new Texture2D(width, height); Color32[] block = new Color32[width * height]; logicImage.FillBlock(block); texture.SetPixels32(block); texture.Apply(); texture.hideFlags = HideFlags.DontSave; }
public void InitAll() { LogicImage li = new LogicImage(ScreenSetting.width, ScreenSetting.height, ScreenSetting.BGColor); line = new LineSegment(); line.Create(li, 10, 10, 100, 100, new Color32(0, 0, 255, 255)); bg = new ImageBase(li); }