public void Select(Grid.Entry entry) { if (_focus != null) _focus.Color = Color.Black; _focus = entry; _focus.Color = Color.DarkSlateBlue; UpdateView(); }
public void Select(Grid.Entry entry) { if (_focus != null) { _focus.Color = Color.Black; } _focus = entry; _focus.Color = Color.DarkSlateBlue; UpdateView(); }
private void Draw(Core core) { foreach (Listing listing in _deck.Where(l => l.Identity.IsValid)) { if (listing.MatchIdentity(core)) { Grid.Entry coreEntry = _grid.ListOfEntries.Where(entry => entry.Core == core).FirstOrDefault(); coreEntry.Color = listing.Color; } } gridView.Render(core, _ga.GetStatusFlags(core)); }
private void resetToolStripMenuItem_Click(object sender, EventArgs e) { Core core = gridContextMenu.Tag as Core; if (core != null) { Grid.Entry coreEntry = _grid.ListOfEntries.Where(entry => entry.Core == core).FirstOrDefault(); coreEntry.ListingID = -1; coreEntry.Color = Color.Black; core.ClearMemory(); Draw(core); } }
private void gridView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right && _loaded) { Grid.Entry entry = gridView.Pick(e.Location); if (entry != null) { //show context menu! gridContextMenu.Tag = entry.Core; gridContextMenu.Show(gridView.PointToScreen(e.Location)); } } }
private void gridView_MouseClick(object sender, MouseEventArgs e) { Grid.Entry entry = gridView.Pick(e.Location); if (e.Button == MouseButtons.Left && entry != null && _focus != entry) { Select(entry); return; } if (e.Button == MouseButtons.Right) { //show context menu! coreContextMenu.Tag = entry.Core; coreContextMenu.Show(gridView.PointToScreen(e.Location)); } }
private void Setup() { gridView.Data = _grid; //Grid & Focus _focus = _grid.Entries[0]; _focus.Color = Color.DarkSlateBlue; //Rendering int w = _coreView.Width * MAIN_CORE_SCALE; int h = _coreView.Height * MAIN_CORE_SCALE; _upscaledCoreBmp = new Bitmap(w, h); _upscaledCoreGfx = Graphics.FromImage(_upscaledCoreBmp); _upscaledCoreGfx.PixelOffsetMode = PixelOffsetMode.Half; _upscaledCoreGfx.InterpolationMode = InterpolationMode.NearestNeighbor; //Target List coreTarget.Items.AddRange(Enum.GetNames(typeof(Core.Focus))); coreTarget.SelectedIndex = (int)Core.Focus.Self; }
public void RebuildBuffer() { _buffer = null; if (_data != null) { int bufferWidth = _data.Width * (_coreView.Width + _coreMargin); int bufferHeight = _data.Height * (_coreView.Height + _coreMargin); _buffer = new Bitmap(bufferWidth, bufferHeight); Graphics gfx = Graphics.FromImage(_buffer); for (int y = 0; y < _data.Height; y++) { for (int x = 0; x < _data.Width; x++) { Grid.Entry entry = _data.Entries[y, x]; _coreView.Render(entry.Core, _interpreter.GetNextInstructionCost(entry.Core), StatusFlags.None, entry.Color); gfx.DrawImage(_coreView.Image, x * (_coreView.Width + _coreMargin), y * (_coreView.Height + _coreMargin)); } } } Invalidate(); }
private void deckSlotPaste_Click(object sender, EventArgs e) { ToolStripMenuItem slotEntry = sender as ToolStripMenuItem; Core core = gridContextMenu.Tag as Core; Listing listing = slotEntry.Tag as Listing; if (core == null || listing == null) { return; } int index = _deck.IndexOf(listing); Grid.Entry coreEntry = _grid.ListOfEntries.Where(entry => entry.Core == core).FirstOrDefault(); coreEntry.ListingID = index; coreEntry.Color = listing.Color; core.ClearMemory(); listing.Compile(core); Draw(core); //update scenario _scenario = Scenario.Create(_grid, _ga.Energy, _deck, _scenario.MissionStatement, true); }