Ejemplo n.º 1
0
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.F4, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.ChangePerspectiveMode(!gl3dcontroller.MatrixCalc.InPerspectiveMode);
            }


            if (kb.HasBeenPressed(Keys.O, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to 90");
                gl3dcontroller.Pan(new Vector2(90, 0), 3);
            }
            if (kb.HasBeenPressed(Keys.P, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to -180");
                gl3dcontroller.Pan(new Vector2(90, 180), 3);
            }

            //System.Diagnostics.Debug.WriteLine("kb check");
        }
Ejemplo n.º 2
0
 private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
 {
     if (kb.HasBeenPressed(Keys.F5, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
     {
         IGLProgramShader ps = items.Shader("Galaxy");
         if (ps != null)
         {
             ps.Enable = !ps.Enable;
             glwfc.Invalidate();
         }
     }
     if (kb.HasBeenPressed(Keys.F6, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
     {
         IGLProgramShader ps = items.Shader("SD");
         if (ps != null)
         {
             ps.Enable = !ps.Enable;
             glwfc.Invalidate();
         }
     }
 }
Ejemplo n.º 3
0
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.P, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.ChangePerspectiveMode(!gl3dcontroller.MatrixCalc.InPerspectiveMode);
            }
            var res = kb.HasBeenPressed(Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7, Keys.D8, Keys.D9);

            if (res != null)
            {
                int n = res.Item1;
                if (n < bodyinfo.Count)
                {
                    track = bodyinfo[n].index;
                }
            }

            if (kb.HasBeenPressed(Keys.D0, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                track = -1;
            }
        }
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.F1, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(0, 0, 0), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F2, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(4, 0, 0), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F3, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(10, 0, -10), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F4, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(50, 0, 50), 1, 2);
            }
        }
Ejemplo n.º 5
0
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.F4, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.ChangePerspectiveMode(!gl3dcontroller.MatrixCalc.InPerspectiveMode);
            }
            if (kb.HasBeenPressed(Keys.F5, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                GalaxyDisplay = !GalaxyDisplay;
            }
            if (kb.HasBeenPressed(Keys.F6, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                StarDotsDisplay = !StarDotsDisplay;
            }
            if (kb.HasBeenPressed(Keys.F7, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                TravelPathDisplay = !TravelPathDisplay;
            }
            if (kb.HasBeenPressed(Keys.F8, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                GalObjectDisplay = !GalObjectDisplay;
            }
            if (kb.HasBeenPressed(Keys.F9, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                if (EDSMRegionsEnable)
                {
                    edsmgalmapregions.Toggle();
                }
                else
                {
                    elitemapregions.Toggle();
                }
            }
            if (kb.HasBeenPressed(Keys.F9, GLOFC.Controller.KeyboardMonitor.ShiftState.Alt))
            {
                bool edsm = EDSMRegionsEnable;
                EDSMRegionsEnable  = !edsm;
                EliteRegionsEnable = edsm;
            }

            if (kb.HasBeenPressed(Keys.F3, GLOFC.Controller.KeyboardMonitor.ShiftState.Shift))
            {
                HistoryEntry prev = travelpath.CurrentList.Last();
                travelpath.AddSystem(new HistoryEntry(DateTime.UtcNow, "new-" + newsys.ToString(), prev.System.X, prev.System.Y, prev.System.Z + 100, Color.DarkSalmon));
                newsys++;
                glwfc.Invalidate();
            }
        }
Ejemplo n.º 6
0
 private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
 {
     if (kb.HasBeenPressed(Keys.F1, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
     {
     }
 }
Ejemplo n.º 7
0
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.F5, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                slset.Remove("GA");
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.F6, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                slset.Remove("GB");
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.F7, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                slset.Remove("GC");
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.F8, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                int       SectorSize = 10;
                Vector3   pos        = new Vector3(20, 0, 30);
                Vector4[] array      = new Vector4[10];
                string[]  text       = new string[array.Length];
                Random    rnd        = new Random();
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = new Vector4(pos.X + rnd.Next(SectorSize), pos.Y + rnd.Next(SectorSize), pos.Z + rnd.Next(SectorSize), 0);
                    text[i]  = "S.D." + i;
                }

                Font fnt  = new Font("MS sans serif", 16f);
                var  mats = GLPLVertexShaderMatrixQuadTexture.CreateMatrices(array, new Vector3(0, 0.6f, 0), new Vector3(2f, 0, 0.4f), new Vector3(-90F.Radians(), 0, 0), true, false);
                var  bmps = GLOFC.Utils.BitMapHelpers.DrawTextIntoFixedSizeBitmaps(slset.LabelSize, text, fnt, System.Drawing.Text.TextRenderingHint.ClearTypeGridFit, Color.White, Color.DarkGreen, 0.5f);

                slset.Add("GD" + (tagn++).ToString(), text, array, mats, bmps);
                GLOFC.Utils.BitMapHelpers.Dispose(bmps);
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.F9, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                slset.Remove("GD");
                gl3dcontroller.Redraw();
            }
            if (kb.HasBeenPressed(Keys.F12, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                slset.RemoveOldest(1);
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.O, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to 90");
                gl3dcontroller.Pan(new Vector2(90, 0), 3);
            }
            if (kb.HasBeenPressed(Keys.P, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to -180");
                gl3dcontroller.Pan(new Vector2(90, 180), 3);
            }

            //System.Diagnostics.Debug.WriteLine("kb check");
        }
Ejemplo n.º 8
0
        // Keys WASD RF Left/Right/Up/Down/PageUp/Down  with none or shift or ctrl
        private bool PositionKeyboard(KeyboardMonitor kbd, bool inperspectivemode, float movedistance)
        {
            Vector3 positionMovement = Vector3.Zero;

            if (kbd.Shift)
            {
                movedistance *= 2.0F;
            }

            if (kbd.HasBeenPressed(Keys.M, KeyboardMonitor.ShiftState.Ctrl))
            {
                YHoldMovement = !YHoldMovement;
            }

            if (kbd.IsCurrentlyPressed(Keys.Left, Keys.A) != null)                // x axis
            {
                positionMovement.X = -movedistance;
            }
            else if (kbd.IsCurrentlyPressed(Keys.Right, Keys.D) != null)
            {
                positionMovement.X = movedistance;
            }

            if (kbd.IsCurrentlyPressed(Keys.PageUp, Keys.R) != null)              // y axis
            {
                positionMovement.Y = movedistance;
            }
            else if (kbd.IsCurrentlyPressed(Keys.PageDown, Keys.F) != null)
            {
                positionMovement.Y = -movedistance;
            }

            if (kbd.IsCurrentlyPressed(Keys.Up, Keys.W) != null)                  // z axis
            {
                positionMovement.Z = movedistance;
            }
            else if (kbd.IsCurrentlyPressed(Keys.Down, Keys.S) != null)
            {
                positionMovement.Z = -movedistance;
            }

            if (positionMovement.LengthSquared > 0)
            {
                if (inperspectivemode)
                {
                    Vector2 cameraDir = CameraDirection;

                    if (YHoldMovement)  // Y hold movement means only the camera rotation around the Y axis is taken into account.
                    {
                        var cameramove = Matrix4.CreateTranslation(positionMovement);
                        var rotY       = Matrix4.CreateRotationY(cameraDir.Y.Radians()); // rotate by Y, which is rotation around the Y axis, which is where your looking at horizontally
                        cameramove *= rotY;
                        Translate(cameramove.ExtractTranslation());
                    }
                    else
                    {
                        var cameramove = Matrix4.CreateTranslation(new Vector3(positionMovement.X, positionMovement.Z, -positionMovement.Y));
                        cameramove *= Matrix4.CreateRotationZ(CameraRotation.Radians());   // rotate the translation by the camera look angle
                        cameramove *= Matrix4.CreateRotationX(cameraDir.X.Radians());
                        cameramove *= Matrix4.CreateRotationY(cameraDir.Y.Radians());
                        Translate(cameramove.ExtractTranslation());
                    }
                }
                else
                {
                    positionMovement.Y = 0;
                    Translate(positionMovement);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 9
0
        // Keys MN, Ctrl1-9
        private bool ZoomKeyboard(KeyboardMonitor kbd, float adjustment)
        {
            bool changed = false;

            if (kbd.IsCurrentlyPressed(KeyboardMonitor.ShiftState.None, Keys.Add, Keys.M) >= 0)
            {
                ZoomBy(adjustment);
                changed = true;
            }

            if (kbd.IsCurrentlyPressed(KeyboardMonitor.ShiftState.None, Keys.Subtract, Keys.N) >= 0)
            {
                ZoomBy(1.0f / adjustment);
                changed = true;
            }

            float newzoom = 0;

            float dist = ZoomMax - ZoomMin;
            float div  = 2048;
            float pow  = 3;

            if (kbd.HasBeenPressed(Keys.D1, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMax;
            }
            if (kbd.HasBeenPressed(Keys.D2, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(7, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D3, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(6, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D4, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(5, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D5, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(4, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D6, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(3, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D7, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(2, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D8, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin + dist * (float)(Math.Pow(1, pow) / div);
            }
            if (kbd.HasBeenPressed(Keys.D9, KeyboardMonitor.ShiftState.Ctrl))
            {
                newzoom = ZoomMin;
            }


            if (newzoom != 0)
            {
                GoToZoom(newzoom, -1);
                changed = true;
            }

            return(changed);
        }
Ejemplo n.º 10
0
        private void OtherKeys(GLOFC.Controller.KeyboardMonitor kb)
        {
            if (kb.HasBeenPressed(Keys.F5, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(0, 0, 0), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F6, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(4, 0, 0), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F7, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(10, 0, -10), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F8, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.PanZoomTo(new Vector3(50, 0, 50), 1, 2);
            }

            if (kb.HasBeenPressed(Keys.F4, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                gl3dcontroller.ChangePerspectiveMode(!gl3dcontroller.MatrixCalc.InPerspectiveMode);
            }

            if (kb.HasBeenPressed(Keys.F2, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                tim2.SetVisiblityRotation("j1", false);
                gl3dcontroller.Redraw();
            }
            if (kb.HasBeenPressed(Keys.F2, GLOFC.Controller.KeyboardMonitor.ShiftState.Shift))
            {
                tim2.SetVisiblityRotation("j1", true);
                gl3dcontroller.Redraw();
            }

            if (kb.HasBeenPressed(Keys.F10, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("F10");
                using (StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap)
                {
                    Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center
                })
                {
                    Font f = new Font("MS sans serif", 8f);
                    tim.Add("T2g", "M3George", f, Color.White, Color.Blue, new Vector3(10, 5, -10), new Vector3(2.5f, 0, 0), new Vector3(0, 0, 0), fmt, rotatetoviewer: true);
                    gl3dcontroller.Redraw();
                }
            }

            if (kb.HasBeenPressed(Keys.F11, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("F11");
                tim.Remove("T2g");
                gl3dcontroller.Redraw();
            }

            //tbd why losing focus? why no key

            if (kb.HasBeenPressed(Keys.O, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to 90");
                gl3dcontroller.Pan(new Vector2(90, 0), 3);
            }
            if (kb.HasBeenPressed(Keys.P, GLOFC.Controller.KeyboardMonitor.ShiftState.None))
            {
                System.Diagnostics.Debug.WriteLine("Order to -180");
                gl3dcontroller.Pan(new Vector2(90, 180), 3);
            }

            //System.Diagnostics.Debug.WriteLine("kb check");
        }