private void StepGrid2(PixelGrid grid, int w, int h, bool togglestate) { bool toggle = togglestate; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (toggle) { grid.DrawPixel(x, y); } toggle = !toggle; } toggle = !toggle; } for (int y = 0; y < testGrid.Height; y++) { for (int x = 0; x < testGrid.Width; x++) { //testGrid.DrawPixel(x, y, ConsoleColor.Black); } g.Draw($"{y}.", ConsoleColor.White, 9, 30 + y); } }
public ExampleMenu(ComapactGraphicsV2.CompactGraphics graphics) : base(graphics) { Random rng = new Random(); listItems = new List <StyledTextT>(); for (int i = 0; i < 200; i++) { listItems.Add(new StyledTextT() { content = new List <ColoredStringT>() { new ColoredStringT($"S{rng.Next()}") } }); } test = new Frame('#', new Rect(1, 9, 1, 9), ConsoleColor.White, ConsoleColor.Black, Widget.DrawPoint.Center); onPage.Add(test); r = new Rect(20, 40, 40, 60); content = new Life(80, 60, 100, 50); pallet = new ExtendedColors(); pixelGrid = new PixelGrid(r); testGrid = new PixelGrid(new Rect(10, 50, 30, 70)); //onPage.Add(testGrid); onPage.Add(pixelGrid); onPage.Add(new ListBox(listItems, new Rect(20, 120, 10, 20), true)); //onPage.Add(new ListBox(new List<Textbox>(), new Rect(10,40,5,40))); //onPage.Add(new Frame('%', r)); //onPage.Add(new Button(r, "This is some text")); }
public void RegisterActions(Gtk.Application app, GLib.Menu menu) { var zoom_section = new GLib.Menu(); menu.AppendSection(null, zoom_section); app.AddAccelAction(ZoomIn, new[] { "<Primary>plus", "<Primary>equal", "equal", "<Primary>KP_Add", "KP_Add" }); zoom_section.AppendItem(ZoomIn.CreateMenuItem()); app.AddAccelAction(ZoomOut, new[] { "<Primary>minus", "<Primary>underscore", "minus", "<Primary>KP_Subtract", "KP_Subtract" }); zoom_section.AppendItem(ZoomOut.CreateMenuItem()); app.AddAccelAction(ActualSize, new[] { "<Primary>0", "<Primary><Shift>A" }); zoom_section.AppendItem(ActualSize.CreateMenuItem()); app.AddAccelAction(ZoomToWindow, "<Primary>B"); zoom_section.AppendItem(ZoomToWindow.CreateMenuItem()); app.AddAccelAction(Fullscreen, "F11"); zoom_section.AppendItem(Fullscreen.CreateMenuItem()); var metric_section = new GLib.Menu(); menu.AppendSection(null, metric_section); var metric_menu = new GLib.Menu(); metric_section.AppendSubmenu(Translations.GetString("Ruler Units"), metric_menu); app.AddAction(RulerMetric); metric_menu.Append(Translations.GetString("Pixels"), $"app.{RulerMetric.Name}(0)"); metric_menu.Append(Translations.GetString("Inches"), $"app.{RulerMetric.Name}(1)"); metric_menu.Append(Translations.GetString("Centimeters"), $"app.{RulerMetric.Name}(2)"); var show_hide_section = new GLib.Menu(); menu.AppendSection(null, show_hide_section); var show_hide_menu = new GLib.Menu(); show_hide_section.AppendSubmenu(Translations.GetString("Show/Hide"), show_hide_menu); app.AddAction(PixelGrid); show_hide_menu.AppendItem(PixelGrid.CreateMenuItem()); app.AddAction(Rulers); show_hide_menu.AppendItem(Rulers.CreateMenuItem()); app.AddAction(ToolBar); show_hide_menu.AppendItem(ToolBar.CreateMenuItem()); app.AddAction(StatusBar); show_hide_menu.AppendItem(StatusBar.CreateMenuItem()); app.AddAction(ToolBox); show_hide_menu.AppendItem(ToolBox.CreateMenuItem()); app.AddAction(ImageTabs); show_hide_menu.AppendItem(ImageTabs.CreateMenuItem()); }
public Player(PixelGrid pg) : base(pg) { if (instance == null) { instance = this; } }
public void Step(PixelGrid target) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { int C = countSourounds(i, j); if (C == 3 || C == 2 && (Ncells[i][j] == 1)) { cells[i][j] = 1; } else { cells[i][j] = (!new int[] { 0, 4 }.Contains(Ncells[i][j])) ? Ncells[i][j] + 1 : 0; } if (cells[i][j] == 1) { target.DrawPixel(i, j, ConsoleColor.White); } } } for (int i = 0; i < height; i++) { Array.Copy(cells[i], 0, Ncells[i], 0, width); } //System.Threading.Thread.Sleep(timeStep); }
public Pixel(PixelGrid grid, Texture2D texture, int x, int y, int pixelSize) { this.Grid = grid; this.Texture = texture; this.X = x; this.Y = y; this.PixelSize = pixelSize; }
private void GetManagers() { p = GetComponent <Player>(); pg = GetComponent <PixelGrid>(); bm = GetComponent <ButtonMash>(); gc = GetComponent <GoalCompletion>(); b = GetComponent <Bugs>(); sgm = GetComponent <StartGameMode>(); }
public PixelGrid Expand(PixelGrid grid, int times) { var current = grid; for (int i = 0; i < times; i++) { current = Expand(current); } return(current); }
private void Start() { _parentGrid = GetComponentInParent <PixelGrid>(); _mesh = GetComponent <MeshFilter>().mesh; _lineRenderer = gameObject.AddComponent <LineRenderer>(); _lineRenderer.material = new Material(Shader.Find("Sprites/Default")); _lineRenderer.widthMultiplier = 0.01f; _lineRenderer.enabled = false; }
private void StepGrid(PixelGrid grid, int w, int h, int coloroffset) { //grid.DrawPixel(25, coloroffset % h); //for (int i = 0; i < w; i++) //{ // for (int j = 0; j <= i; j++) // { // grid.DrawPixel(i, j, colors[((i + coloroffset) % 14) + 1]); // grid.DrawPixel(j, i, colors[((i + coloroffset) % 14) + 1]); // } //} int half = w / 2; //bottm right for (int i = 0; i < half; i++) { for (int j = 0; j <= i; j++) { grid.DrawPixel(i + half, j + half + 1, colors[((i + coloroffset) % 14) + 1]); grid.DrawPixel(j + half, i + half + 1, colors[((i + coloroffset) % 14) + 1]); } } ////top left for (int i = half; i > 0; i--) { for (int j = half; j >= i; j--) { grid.DrawPixel(i, j, colors[(((half - i) + coloroffset) % 14) + 1]); grid.DrawPixel(j, i, colors[(((half - i) + coloroffset) % 14) + 1]); } } //top right for (int i = 0; i < half; i++) { for (int j = 0; j <= i; j++) { grid.DrawPixel(i + half, half - j, colors[((i + coloroffset) % 14) + 1]); grid.DrawPixel(j + half, half - i, colors[((i + coloroffset) % 14) + 1]); } } for (int i = half; i > 0; i--) { for (int j = half; j >= i; j--) { grid.DrawPixel(i, w - j, colors[(((half - i) + coloroffset) % 14) + 1]); grid.DrawPixel(j, w - i, colors[(((half - i) + coloroffset) % 14) + 1]); } } if (cof % 2 == 1) { AddRainbow(); } }
public IntroMenu(CompactGraphics g) : base(g) { int centralX = 50.PercentX(); mainTextbox = new CustomTextBox(new Rect(5.PercentX(), 95.PercentX(), 95.PercentY() - 7, 95.PercentY())); Image = new PixelGrid(new Rect(centralX, centralX + 32, 50.PercentY() - 8, 50.PercentY() + 8)); Image.PinTo(Widget.DrawPoint.Top); onPage.Add(mainTextbox); onPage.Add(Image); mainTextbox.updateText(TheCureGame.TextLines.IntroLines[0]); }
private void CreateTextures() { m_Grid = Grid; m_Textures = new Texture2D[m_Grid.Layers]; for (int layer = 0; layer < m_Grid.Layers; layer++) { m_Textures[layer] = new Texture2D(m_Grid.Width, m_Grid.Height, TextureFormat.RGB24, false) { filterMode = FilterMode.Point, wrapMode = TextureWrapMode.Clamp }; } }
private void InitTextures(PixelGrid grid) { m_Grid = grid; m_Textures = new Texture2D[m_Grid.Layers]; for (int i = 0, n = m_Grid.Layers; i < n; i++) { m_Textures[i] = new Texture2D(m_Grid.Width, m_Grid.Height, TextureFormat.RGB24, false) { filterMode = FilterMode.Point, wrapMode = TextureWrapMode.Clamp }; } }
public override void activate(int ex, int ey) { PixelGrid pg = pixelGridPanel.ActiveGrid; int gx = pixelGridPanel.gridPixelX(ex); int gy = pixelGridPanel.gridPixelY(ey); RGB baseColor = pg.getPixel(gx, gy); RGB toColor = pixelGridPanel.drawColor; if (baseColor != toColor) { fillSparkPos = new Vector(gx, gy); process(gx, gy, baseColor, toColor); pixelGridPanel.Invalidate(); } }
public void CreateMainMenu(Gtk.Menu menu) { MenuItem show_pad = (MenuItem)menu.Children[0]; menu.Remove(show_pad); menu.Append(ToolBar.CreateMenuItem()); menu.Append(PixelGrid.CreateMenuItem()); menu.Append(Rulers.CreateMenuItem()); menu.Append(ImageTabs.CreateMenuItem()); menu.AppendSeparator(); ImageMenuItem zoomin = ZoomIn.CreateAcceleratedMenuItem(Gdk.Key.plus, Gdk.ModifierType.ControlMask); zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, 0, AccelFlags.Visible)); zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, 0, AccelFlags.Visible)); menu.Append(zoomin); ImageMenuItem zoomout = ZoomOut.CreateAcceleratedMenuItem(Gdk.Key.minus, Gdk.ModifierType.ControlMask); zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, 0, AccelFlags.Visible)); zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, 0, AccelFlags.Visible)); menu.Append(zoomout); ImageMenuItem actualsize = ActualSize.CreateAcceleratedMenuItem(Gdk.Key.Key_0, Gdk.ModifierType.ControlMask); actualsize.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible)); menu.Append(actualsize); menu.Append(ZoomToWindow.CreateAcceleratedMenuItem(Gdk.Key.B, Gdk.ModifierType.ControlMask)); //menu.Append (ZoomToSelection.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask)); menu.Append(Fullscreen.CreateAcceleratedMenuItem(Gdk.Key.F11, Gdk.ModifierType.None)); menu.AppendSeparator(); Gtk.Action unit_action = new Gtk.Action("RulerUnits", Mono.Unix.Catalog.GetString("Ruler Units"), null, null); Menu unit_menu = (Menu)menu.AppendItem(unit_action.CreateSubMenuItem()).Submenu; unit_menu.Append(Pixels.CreateMenuItem()); unit_menu.Append(Inches.CreateMenuItem()); unit_menu.Append(Centimeters.CreateMenuItem()); menu.AppendSeparator(); menu.Append(show_pad); }
void setUpCurrentSpriteList() { for (int i = 0; i < 3; i++) { var random = Random.Range(0, spriteList.Count); currentSpriteRenderers[i].sprite = spriteList[random]; currentSpriteRenderers[i].GetComponent <PixelGrid>().setPixelMap(); spriteList.RemoveAt(random); } //select randomly one of the three current sprites gridOfPixels = GetComponentsInChildren <PixelGrid>()[Random.Range(0, currentSpriteRenderers.Count)]; print(gridOfPixels.GetComponent <SpriteRenderer>().sprite.name); correctDirection = gridOfPixels.transform.parent.GetComponentInChildren <Selector>().direction; }
//edit for 3d //takes an int i (number of chunks created thus far), and an (x,y) point //we instantiate the grid prefab, then set its position relative to the pixelMap private void CreateChunk(int i, int x, int y) { PixelGrid chunk = Instantiate(pixelGridPrefab) as PixelGrid; chunk.Initialize(pixelResolution, chunkSize); chunk.transform.parent = transform; chunk.transform.localPosition = new Vector3(x * chunkSize - halfSize, y * chunkSize - halfSize); chunks[i] = chunk; if (x > 0) { chunks[i - 1].xNeighbor = chunk; } if (y > 0) { chunks[i - chunkResolution].yNeighbor = chunk; if (x > 0) { chunks[i - chunkResolution - 1].xyNeighbor = chunk; } } }
private void StepGrid3(PixelGrid grid, int w, int h) { int lines = w / 15; int color = 1; for (int x = 0; x < w; x++) { switch (x % lines) { case 0: color++; break; default: for (int y = 0; y < h; y++) { grid.DrawPixel(x, y, (ConsoleColor)color); } break; } } AddRainbow(); }
protected override void ResetState() { particleSystem = null; expanded5 = null; }
public PixelGrid Expand(PixelGrid grid) { var patternCodes = grid.GetGroupPatternCodes(); return(PixelGrid.FromGroupedGrids(patternCodes.SelectArray(code => rules[inputRuleMatches[code]].Output))); }
private record EnchantmentRule(PixelGrid Input, PixelGrid Output) {
private bool GridIsInvalid(out PixelGrid updatedGrid) { updatedGrid = GetGrid(); return(updatedGrid != m_Grid); }
public Entity(PixelGrid pg) { this.collisionGrid = pg; }