Esempio n. 1
0
 public void SetMode(Mode mode)
 {
     if (!modeTimer.Ready())
     {
         return;
     }
     modeTimer.Reset();
     this.mode = mode;
 }
Esempio n. 2
0
 public void ToggleCrosshair()
 {
     if (!crosshairtimer.Ready())
     {
         return;
     }
     crosshairtimer.Reset();
     crosshair = !crosshair;
 }
Esempio n. 3
0
        private static void Update()
        {
            if (Input.Keys(Key.Tab))
            {
                if (activeFractalTimer.Ready())
                {
                    activeFractal = activeFractal == Fractal.FractalType.Mandelbrot ? Fractal.FractalType.Julia : Fractal.FractalType.Mandelbrot;
                    activeFractalTimer.Reset();
                }
            }

            if (activeFractal == Fractal.FractalType.Mandelbrot)
            {
                HandleKeys(mandelbrot);
            }
            else
            {
                HandleKeys(julia);
            }

            float clr_amt = GameTime.DeltaTime / 1000 * (Input.Keys(Key.LeftShift) ? 1 : -1);

            if (Input.Keys(Key.Z))
            {
                mandelbrot.clrRatio.R += clr_amt;
                julia.clrRatio.R      += clr_amt;
            }
            if (Input.Keys(Key.X))
            {
                mandelbrot.clrRatio.G += clr_amt;
                julia.clrRatio.G      += clr_amt;
            }
            if (Input.Keys(Key.C))
            {
                mandelbrot.clrRatio.B += clr_amt;
                julia.clrRatio.B      += clr_amt;
            }

            if (Input.Keys(Key.J))
            {
                mandelbrot.rot -= GameTime.DeltaTime / 200;
                julia.rot      -= GameTime.DeltaTime / 200;
            }
            if (Input.Keys(Key.L))
            {
                mandelbrot.rot += GameTime.DeltaTime / 200;
                julia.rot      += GameTime.DeltaTime / 200;
            }

            if (Input.Keys(Key.One))
            {
                julia.SetMode(Fractal.Mode.Normal);
            }
            if (Input.Keys(Key.Two))
            {
                julia.SetMode(Fractal.Mode.Reciprocal);
            }
            if (Input.Keys(Key.Three))
            {
                julia.SetMode(Fractal.Mode.SquaredReciprocal);
            }
            if (Input.Keys(Key.Four))
            {
                julia.SetMode(Fractal.Mode.t1);
            }
            if (Input.Keys(Key.Five))
            {
                julia.SetMode(Fractal.Mode.t2);
            }
            if (Input.Keys(Key.Six))
            {
                julia.SetMode(Fractal.Mode.t3);
            }

            if (Input.Keys(Key.Escape))
            {
                Glfw.SetWindowShouldClose(window, true);
            }
        }