예제 #1
0
        /// <summary>
        /// Run logic for this state - including input
        /// </summary>
        /// <param name="GameTime">Snapshot of timing</param>
        public override void Update(GameTime GameTime)
        {
            // Get the current state, get the last state, and any new buttons are acted upon
            var currentState = Keyboard.GetState();

            foreach (var i in currentState.GetPressedKeys())
            {
                if (LastState.IsKeyUp(i))
                {
                    StateStack.Clear();
                }
            }


            // Get touch state
            var touchState = TouchPanel.GetState();

            foreach (var touch in touchState)
            {
                if (touch.State == TouchLocationState.Pressed)
                {
                    StateStack.Clear();
                }
            }

            LastState = currentState;
        }
예제 #2
0
        /// <summary>
        /// Begin drawing a new frame.<br/>
        /// Calls to NanoVG drawing API should be wrapped in <see cref="BeginFrame(Vector2D{float}, float)"/> and <see cref="EndFrame()"/>.
        /// <para><see cref="BeginFrame(Vector2D{float}, float)"/> defines the size of the window to render to in relation currently
        /// set viewport (i.e. glViewport on GL backends). Device pixel ratio allows to
        /// control the rendering on Hi-DPI devices.</para>
        /// <para>For example, GLFW returns two dimension for an opened window: window size and
        /// frame buffer size. In that case you would set windowWidth / Height to the window size,
        /// devicePixelRatio to: <c>frameBufferWidth / windowWidth</c>.</para>
        /// </summary>
        public void BeginFrame(Vector2D <float> windowSize, float devicePixelRatio)
        {
            fontManager.Pack();

            stateStack.Clear();
            Save();
            Reset();

            pixelRatio.SetDevicePixelRatio(devicePixelRatio);

            renderer.Viewport(windowSize, devicePixelRatio);

            FrameMeta = default;
        }
예제 #3
0
        public void PopAllStates()
        {
            if (StateStack.Count < 1)
            {
                return;
            }

            var first = StateStack.First();

            StateStack.Clear();

            Position = first.Position;
            Mode     = first.Mode;
        }
예제 #4
0
        /// <summary>
        /// Run logic for this state - including input
        /// </summary>
        /// <param name="GameTime">Snapshot of timing</param>
        public override void Update(GameTime GameTime)
        {
            // Get the current state, get the last state, and any new buttons are acted upon
            var currentState = Keyboard.GetState();

            foreach (var i in currentState.GetPressedKeys())
            {
                if (LastState.IsKeyUp(i))
                {
                    StateStack.Clear();
                }
            }
            LastState = currentState;
        }
예제 #5
0
 /// <summary>
 /// Clears the stack. The Depth will be reset to zero.
 /// </summary>
 public void Clear()
 {
     _impStack.Clear();
     _countStack.Clear();
     Depth = 0;
 }
예제 #6
0
 public void ClearState()
 {
     StateStack.Clear();
     CurrentState = null;
     NextState    = null;
 }
예제 #7
0
 public void Commit()
 {
     StateStack.Clear();
 }
예제 #8
0
 public void Clear()
 {
     StateStack.Clear();
 }