예제 #1
0
 /// <summary>
 /// Resize the stack in a non-destructive way
 /// </summary>
 /// <param name="newSize">The new size of the stack</param>
 public void resize(int newSize)
 {
     if (newSize > m_size)
     {
         int nextSize = (newSize > m_size * 2) ? newSize : m_size * 2;
         FontDrawCommand[] tempStack = new FontDrawCommand[nextSize];
         for (int i = 0; i <= m_top; i++)
         {
             tempStack[i] = m_stack[i];
         }
         m_stack = tempStack;
         tempStack = null;
         m_size = nextSize;
         initializeStack();
     }
 }
예제 #2
0
 protected void initializeStack()
 {
     for (int i = m_top + 1; i < m_size; i++)
     {
         m_stack[i] = new FontDrawCommand(m_spriteBatch);
     }
 }
예제 #3
0
 /// <summary>
 /// Pushes a FontDrawCommand onto the FontStack to be drawn.
 /// If possible, it is better to use pushGet() for garbage reasons.
 /// </summary>
 /// <param name="drawCommand">Font draw command to be drawn.</param>
 internal void push(FontDrawCommand drawCommand)
 {
     if (m_top == m_size - 1)
     {
         resize(m_size + 1);
     }
     m_top++;
     m_stack[m_top] = drawCommand;
 }