public CCTextureAtlas(CCTexture2D tex,int n){
  capacity_=n;
  texture_=tex;
  totalQuads_=0;
  withColorArray_=false;
  ByteBuffer tbb=ByteBuffer.allocateDirect(ccQuad2.size * capacity_ * 4);
  tbb.order(ByteOrder.nativeOrder());
  textureCoordinates=tbb.asFloatBuffer();
  ByteBuffer vbb=ByteBuffer.allocateDirect(ccQuad3.size * capacity_ * 4);
  vbb.order(ByteOrder.nativeOrder());
  vertexCoordinates=vbb.asFloatBuffer();
  ByteBuffer isb=ByteBuffer.allocateDirect(6 * capacity_ * 2);
  isb.order(ByteOrder.nativeOrder());
  indices=isb.asShortBuffer();
  initIndices();
}

public CCTextureAtlas ( CCTexture2D tex , int n ) { capacity_ = n ; texture_ = tex ; totalQuads_ = 0 ; withColorArray_ = false ; ByteBuffer tbb = ByteBuffer . allocateDirect ( ccQuad2 . size * capacity_ * 4 ) ; tbb . order ( ByteOrder . nativeOrder ( ) ) ; textureCoordinates = tbb . asFloatBuffer ( ) ; ByteBuffer vbb = ByteBuffer . allocateDirect ( ccQuad3 . size * capacity_ * 4 ) ; vbb . order ( ByteOrder . nativeOrder ( ) ) ; vertexCoordinates = vbb . asFloatBuffer ( ) ; ByteBuffer isb = ByteBuffer . allocateDirect ( 6 * capacity_ * 2 ) ; isb . order ( ByteOrder . nativeOrder ( ) ) ; indices = isb . asShortBuffer ( ) ; initIndices ( ) ; }
initializes a textureatlas with a previously initialized texture2d object , and with an initial capacity for quads . the textureatlas capacity can be increased in runtime . warning : do not reinitialize the textureatlas because it will leak memory ( issue # 706 )
