Beispiel #1
0
        public World()
        {
            RenderablesList = new List<RenderableComponent>();
            PixelToMetreScale = 32f;
            //Gravity = new Vector2(0f, 0.8f);
            Camera = new Camera(new Vector2(0, 0));
            Engine.GraphicsSystem.SetCamera(Camera);
            Engine.InputSystem.Keyboard.Register(Keys.A, InputType.Down,
                () => this.Camera.Move(new Vector2(10f, 0)));

            Engine.InputSystem.Keyboard.Register(Keys.D, InputType.Down,
                () => this.Camera.Move(new Vector2(-10f, 0)));

            Engine.InputSystem.Keyboard.Register(Keys.W, InputType.Down,
                () => this.Camera.Move(new Vector2(0, 10f)));

            Engine.InputSystem.Keyboard.Register(Keys.S, InputType.Down,
                () => this.Camera.Move(new Vector2(0, -10f)));

            Engine.InputSystem.Keyboard.Register(Keys.Q, InputType.Down,
                () => this.Camera.Rotate(-Camera.RotationSpeed));

            Engine.InputSystem.Keyboard.Register(Keys.E, InputType.Down,
                () => this.Camera.Rotate());

            Engine.InputSystem.Keyboard.Register(Keys.Z, InputType.Down,
                () => this.Camera.Zoom(-Camera.ZoomSpeed));

            Engine.InputSystem.Keyboard.Register(Keys.X, InputType.Down,
                () => this.Camera.Zoom(Camera.ZoomSpeed));
        }
 public void SetCamera(Camera camera)
 {
     transform = camera;
 }