// window events

        public void handleInput(object sender, EventArgs e)
        {
            int to_i(bool b) => b ? 1 : 0;

            var movement = UVector2.Normalized(new Vector2(
                                                   to_i(this.input["left"]) - to_i(this.input["right"]),
                                                   to_i(this.input["up"]) - to_i(this.input["down"])
                                                   )) * this.camera_speed;

            if (movement != Vector2.Zero)
            {
                Universe.camera.position += (10 / Universe.camera.zoom) * movement;
            }

            if (this.input.Values.Contains(true))
            {
                // redraw only when needed
                this.redraw();
            }
        }
Beispiel #2
0
 public static Vector2 mod2(Vector2 a, float b) => a - b * UVector2.Floor(a / b);
Beispiel #3
0
 public static Vector2 mod3(Vector2 a, float b) => a - new Vector2(Math.Abs(b)) * UVector2.Floor(a / Math.Abs(b));
Beispiel #4
0
 public static Vector2 mod3(Vector2 a, Vector2 b) => a - Vector2.Abs(b) * UVector2.Floor(a / Vector2.Abs(b));