Esempio n. 1
0
        public InputHandler InitializeInputHandler(GameWindow gameWindow)
        {
            InputHandler inputHandler = new InputHandler(gameWindow);

            inputHandler.AddPressKeyAction(Key.Escape, (int)KeyAction.Exit);
            inputHandler.AddPressKeyAction(Key.F11, (int)KeyAction.ToggleFullscreen);
            inputHandler.AddPressKeyAction(Key.E, (int)KeyAction.SelectMaterial);
            inputHandler.AddPressKeyAction(Key.F5, (int)KeyAction.Save);
            inputHandler.AddPressKeyAction(Key.F6, (int)KeyAction.SaveAs);
            inputHandler.AddPressKeyAction(Key.F8, (int)KeyAction.Load);

            inputHandler.AddHoldKeyAction(Key.W, (int)KeyAction.MoveForwards);
            inputHandler.AddHoldKeyAction(Key.Up, (int)KeyAction.MoveForwards);
            inputHandler.AddHoldKeyAction(Key.S, (int)KeyAction.MoveBackwards);
            inputHandler.AddHoldKeyAction(Key.Down, (int)KeyAction.MoveBackwards);
            inputHandler.AddHoldKeyAction(Key.A, (int)KeyAction.MoveLeft);
            inputHandler.AddHoldKeyAction(Key.Left, (int)KeyAction.MoveLeft);
            inputHandler.AddHoldKeyAction(Key.D, (int)KeyAction.MoveRight);
            inputHandler.AddHoldKeyAction(Key.Right, (int)KeyAction.MoveRight);
            inputHandler.AddHoldKeyAction(Key.Space, (int)KeyAction.MoveUp);
            inputHandler.AddHoldKeyAction(Key.ShiftLeft, (int)KeyAction.MoveDown);
            inputHandler.AddHoldKeyAction(Key.Q, (int)KeyAction.RayTraceEmpty);

            inputHandler.AddPressKeyAction(MouseButton.Left, (int)KeyAction.PlaceMaterial);
            inputHandler.AddPressKeyAction(MouseButton.Right, (int)KeyAction.TakeMaterial);
            return(inputHandler);
        }