Exemple #1
0
        /// <inheritdoc/>
        public PointerState GetState()
        {
            var state = new PointerState();

            GetState(state);

            return(state);
        }
Exemple #2
0
        /// <inheritdoc/>
        public void GetState(PointerState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            state.Points.Clear();

            foreach (var point in statePointerPoints)
            {
                state.Points.Add(point);
            }
        }
        public AudioGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Create the pointer manager
            pointerManager = new PointerManager(this);
            pointerState = new PointerState();

            IsMouseVisible = true;

            random = new Random();

            audioManager = new AudioManager(this);
            audioManager.EnableMasterVolumeLimiter();
            //EnableSpatialAudioWithReverb();

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

        }
Exemple #4
0
 public void UpdateInputDevices()
 {
     KeyboardState = KeyboardManager.GetState();
     KeyboardState.GetDownKeys(_downKeys);
     MouseState = MouseManager.GetState();
     if(PointerManager!=null)
         PointerState = PointerManager.GetState();
 }
        /// <inheritdoc/>
        public PointerState GetState()
        {
            var state = new PointerState();

            GetState(state);

            return state;
        }
        /// <inheritdoc/>
        public void GetState(PointerState state)
        {
            if(state == null) throw new ArgumentNullException("state");

            state.Points.Clear();

            foreach(var point in statePointerPoints)
                state.Points.Add(point);
        }
        /// <summary>
        /// Update the state of all desired input devices.
        /// </summary>
        /// <param name="gameTime"></param>
        override public void Update(GameTime gameTime)
        {   
            // update state
            keyboardManager.Update(gameTime);
            keyboardState = keyboardManager.GetState();
            mouseState = mouseManager.GetState();
            pointerState = pointerManager.GetState();

              
            //mouseClick = mouseState.LeftButton.Pressed && !prevMouseState.LeftButton.Pressed;
            //mouseHeld = mouseState.LeftButton.Pressed && prevMouseState.LeftButton.Pressed;

            if (accelerometer != null) {
                accelerometerReading = accelerometer.GetCurrentReading();
                
            }

            // get mouse delta and reset mouse to centre of window
            if (useMouseDelta && mouseManager.Enabled) {
                mouseDelta = new Vector2(0.5f - mouseState.X, 0.5f - mouseState.Y);
                mouseManager.SetPosition(new Vector2(0.5f, 0.5f));
            }

            // record previous mouse state
            prevMouseState = mouseState;

 	        base.Update(gameTime);
        }