示例#1
0
        protected void DequeueOldStates(GameTime currentTime)
        {
            InputStateExtended <S> state = null;

            if (m_RecordedStates.Count > 0)
            {
                state = m_RecordedStates.Peek();
            }
            if (state != null && state.StateTime < currentTime.TotalGameTime.Subtract(new TimeSpan(0, 0, 0, 0, InputDeviceConstants.ClickCountTimeMS)))
            {
                m_StatesForReuse.Push(m_RecordedStates.Dequeue());
                DequeueOldStates(currentTime);
            }
        }
示例#2
0
 private InputStateExtended <S> CreateState(GameTime time, S state)
 {
     if (m_StatesForReuse.Count > 0)
     {
         //Reuses the object to fight of the GC
         InputStateExtended <S> stateExt = m_StatesForReuse.Pop();
         stateExt.StateTime = time.TotalGameTime;
         stateExt.State     = state;
         return(stateExt);
     }
     else
     {
         return(new InputStateExtended <S>(time, state));
     }
 }