// Public methods public override void Connect(bool connect) { base.Connect(connect); if (connect) { ConnectEventHandlers(true); ConnectCons(true); CommandCon.Clear(); Clock.Tick += Clock_Tick; ClockStartup(); } else { ClockShutdown(); Clock.Tick -= Clock_Tick; RenderCon.InvalidateProgram(); CommandCon.Clear(); ConnectCons(false); ConnectEventHandlers(false); AppCon.Remove(this); } }
public void RecreateSceneControl() { GLControl oldControl = GetSceneControl(), newControl = new GLControl(); var parent = oldControl.Parent; newControl.BackColor = Scene.BackgroundColour; newControl.Dock = DockStyle.Fill; newControl.Location = new System.Drawing.Point(0, 0); newControl.Name = "SceneControl"; newControl.Size = new System.Drawing.Size(100, 100); newControl.TabIndex = 1; newControl.VSync = Scene.VSync; parent.SuspendLayout(); SceneCon.Connect(false); parent.Controls.Remove(oldControl); parent.Controls.Add(newControl); SceneCon.Connect(true); RenderCon.Refresh(); parent.ResumeLayout(); oldControl.Dispose(); }
private void SceneControl_Paint(object sender, PaintEventArgs e) => RenderCon.Render();
private void Resize() => RenderCon.InvalidateProjection();
private void Clock_Tick(object sender, EventArgs e) => RenderCon.Render();