public void ToggleCrosshair() { if (!crosshairtimer.Ready()) { return; } crosshairtimer.Reset(); crosshair = !crosshair; }
public void SetMode(Mode mode) { if (!modeTimer.Ready()) { return; } modeTimer.Reset(); this.mode = mode; }
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 (Input.Keys(Key.B)) { if (fractalsToRenderTimer.Ready()) { int f = (int)(fractalsToRender) + 1; f %= 3; fractalsToRender = (FractalsToRender)f; fractalsToRenderTimer.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); } if (Input.Keys(Key.F1)) { if (screenshotTimer.Ready()) { screenshotTimer.Reset(); SaveScreenshot(); } } switch (fractalsToRender) { case FractalsToRender.Mandelbrot: mandelbrot.quad.pos = Vector2.Zero; mandelbrot.quad.model.size = new Vector2(1, 1); julia.quad.model.size = Vector2.Zero; activeFractal = Fractal.FractalType.Mandelbrot; break; case FractalsToRender.Julia: julia.quad.pos = Vector2.Zero; julia.quad.model.size = new Vector2(1, 1); mandelbrot.quad.model.size = Vector2.Zero; activeFractal = Fractal.FractalType.Julia; break; case FractalsToRender.MandelbrotJulia: mandelbrot.quad.pos = new Vector2(-0.5f, 0f); mandelbrot.quad.model.size = new Vector2(0.5f, 1); julia.quad.pos = new Vector2(0.5f, 0f); julia.quad.model.size = new Vector2(0.5f, 1f); break; } }