public MainForm() { InitializeComponent(); graph = PictureBox_Main.CreateGraphics(); ResetUICounters(); updateTimer = new Timer(); updateTimer.Interval = 100; updateTimer.Tick += TimerUpdate; updateTimer.Start(); }
public void StartNewSimulation(Simulation simulation) { this.simulation?.SafeStop(); this.simulation = simulation; graph = PictureBox_Main.CreateGraphics(); drawer = new Drawer(graph, graph.VisibleClipBounds, simulation); simulation.Updated += drawer.Draw; simulation.CellStateChanged += drawer.RedrawPosition; UpdateChildControlsWithNewOptions(simulation.GetCurrentOptions()); drawer.RedrawAllPositions(); ResetUICounters(); simulation.Simulate(); Pause(); }
void ClearScreen() { PictureBox_Main.CreateGraphics().Clear(System.Drawing.Color.Black); }
private void MainForm_ResizeEnd(object sender, EventArgs e) { graph = PictureBox_Main.CreateGraphics(); drawer?.UpdateGraphicsNextFrame(graph, graph.VisibleClipBounds); drawer?.RedrawAllPositions(); }