private void glDisplay_KeyDown(object sender, KeyEventArgs e) { bool hasFocus = this.Focused; if (!hasFocus) { foreach (Control ctl in this.Controls) { if (ctl.Focused) { hasFocus = true; break; } } } if (hasFocus) { //Move camera here if (e.KeyData == Keys.W) { SFCamera.Movement(false, 6.0f); } if (e.KeyData == Keys.S) { SFCamera.Movement(false, -6.0f); } if (e.KeyData == Keys.A) { SFCamera.Movement(true, -6.0f); } if (e.KeyData == Keys.D) { SFCamera.Movement(true, 6.0f); } if (e.KeyData == Keys.T) { SFCamera.Movement(false, 24.0f); } if (e.KeyData == Keys.G) { SFCamera.Movement(false, -24.0f); } if (e.KeyData == Keys.F) { SFCamera.Movement(true, -24.0f); } if (e.KeyData == Keys.H) { SFCamera.Movement(true, 24.0f); } } }
private void glDisplay_MouseMove(object sender, MouseEventArgs e) { if (Mouse.IsClicked) { SFCamera.MouseMove(e.X, e.Y); } }
private void glDisplay_Load(object sender, EventArgs e) { if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } SFCamera.Reset(); //If there are unitialized-related errors, it's probably setting this too early GL.ClearColor(Color.CornflowerBlue); SetupViewport(); GLLoaded = true; }