示例#1
0
        public CustomKeyboardBindingMap(CustomActionList actions) : base(actions)
        {
            this.Bind(Keys.Z, ButtonState3.Hold, actions.PlayerForward);
            this.Bind(Keys.D, ButtonState3.Hold, actions.PlayerRight);
            this.Bind(Keys.Q, ButtonState3.Hold, actions.PlayerLeft);
            this.Bind(Keys.S, ButtonState3.Hold, actions.PlayerBackward);

            this.Bind(Keys.Space, ButtonState3.JustPressed, actions.Pause);
        }
        public CustomMouseBindingMap(CustomActionList actions)
        {
            Sensibilite = 1 / 200f;

            this.BindAxisDelta(MouseAxis.X, actions.RotateCameraHorizontally, Sensibilite);
            this.BindAxisDelta(MouseAxis.Y, actions.RotateCameraVertically, Sensibilite);

            this.BindButton(MouseButton.LeftButton, ButtonState3.JustPressed, actions.Shoot);
            this.BindButton(MouseButton.RightButton, ButtonState3.Hold, actions.Shoot);
        }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _graphicSettings.Initialize();

            CustomContentLoader loader   = new CustomContentLoader(this.Content);
            CustomWorld         world    = new CustomWorld(new CustomPhysicGenerator(loader));
            Tracker             tracker  = new Tracker(world.Player, 15f);
            Renderer            renderer = new BasicRenderer(_graphicSettings, Content, 45f, tracker);

            _logic   = new LogicManager(world);
            _graphic = new GraphicManager(_logic, tracker, renderer, new CustomGraphicGenerator(loader));

            CustomActionList actionList = new CustomActionList(this, _graphicSettings, world, tracker);
            KeyboardHandler  kh         = new KeyboardHandler(new CustomKeyboardBindingMap(actionList));
            MouseHandler     mh         = new MouseHandler(new CustomMouseBindingMap(actionList), true);

            _input = new InputManager(kh, mh);

            _logic.Start();

            base.Initialize();
        }