public void Setup()
        {
            GalaxyRenderer.Render(currentView, Width, Height,
                                  GalaxyRenderer.DefaultColorMapping,
                                  null, out maxDensity, ref coordinates);

            var moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3;

            AddKeyAction("E", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3; });
            AddKeyAction("Q", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3;; });
            AddKeyAction("W", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3; });
            AddKeyAction("S", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3; });
            AddKeyAction("A", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3; });
            AddKeyAction("D", (t) => { moveFraction = Math.Abs(currentView.Top - currentView.Bottom) / 3; });

            AddKeyAction("E", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView *= 0.9f; });
            AddKeyAction("Q", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView *= 1.1f; });
            AddKeyAction("W", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView += new Viewport(moveFraction, moveFraction, 0, 0); });
            AddKeyAction("S", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView += new Viewport(-moveFraction, -moveFraction, 0, 0); });
            AddKeyAction("A", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView += new Viewport(0, 0, -moveFraction, -moveFraction); });
            AddKeyAction("D", (t) => { if (!t)
                                       {
                                           return;
                                       }
                                       currentView += new Viewport(0, 0, moveFraction, moveFraction); });

            AddKeyAction("X", (t) =>
            {
                if (!t)
                {
                    return;
                }
                Form.Hide();
                coordinates.Dispose();
                coordinates = Gpu.Default.AllocateReadOnlyBuffer(Converter.GetCoordinates(Program.BinPath));
                Form.Show();
            });
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            ArrayPool <float> .Shared.Return(X);

            ArrayPool <float> .Shared.Return(W);

            ArrayPool <float> .Shared.Return(B);

            ArrayPool <float> .Shared.Return(Y);

            BufferX.Dispose();
            BufferW.Dispose();
            BufferB.Dispose();
            BufferY.Dispose();
        }