Ejemplo n.º 1
0
        /// <inheritdoc/>
        public PointerState GetState()
        {
            var state = new PointerState();

            GetState(state);

            return(state);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
        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";

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

            GetState(state);

            return state;
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        /// <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);
        }