/// <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 > size_) { int nextSize = (newSize > size_ * 2) ? newSize : size_ * 2; FontDrawer[] tempStack = new FontDrawer[nextSize]; for (int i = 0; i <= top_; i++) { tempStack[i] = stack_[i]; } stack_ = tempStack; tempStack = null; size_ = nextSize; initializeStack(); } }
protected void initializeStack() { for (int i = top_ + 1; i < size_; i++) { stack_[i] = new FontDrawer(spriteBatch_); } }