public GameDisplay() { InitializeComponent(); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); InitializeLevelAndNetwork(); OutputNeuron left = new OutputNeuron(); left.OutputEvent += (sender, args) => leftPressed = true; network.AddNeuron(left); OutputNeuron right = new OutputNeuron(); right.OutputEvent += (sender, args) => rightPressed = true; network.AddNeuron(right); OutputNeuron up = new OutputNeuron(); up.OutputEvent += (sender, args) => upPressed = true; network.AddNeuron(up); }
private void panel1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { Neuron spawnedNeuron; if (rbNeuron.Checked) { spawnedNeuron = new Neuron(); } else if (rbInputNeuron.Checked) { spawnedNeuron = new InputNeuron(); } else if (rbOutputNeuron.Checked) { spawnedNeuron = new OutputNeuron(); ((OutputNeuron)spawnedNeuron).OutputEvent += (obj, args) => MessageBox.Show("AYY LMAO"); } else { throw new InvalidOperationException("No radio button is checked!"); } myNetwork.AddNeuron(spawnedNeuron); NeuronDisplay disp = new NeuronDisplay(spawnedNeuron); disp.Location = new Point(Cursor.Position.X - this.Location.X, Cursor.Position.Y - this.Location.Y); this.Controls.Add(disp); disp.BringToFront(); } }