addSubTexture method

void addSubTexture(
  1. String? name,
  2. GSubTexture subTexture
)

Adds a GSubTexture with the given name to the atlas.

The subTexture parameter is the GSubTexture to be added.

Throws an exception if the root GTexture of the subTexture does not match the atlas GTexture.

Implementation

void addSubTexture(String? name, GSubTexture subTexture) {
  if (subTexture.root != _atlasTexture!.root) {
    throw 'SubTexture\'s root must be an Atlas Texture.';
  }
  _subTextures![name] = subTexture;
  _subTexturesNames = null;
}