Skip to content

File naming #4

@coccor

Description

@coccor

If you have a TexturePack and want to change its texture the asset filename must not be the same or it won't change the texture.
For example:
I have a texture pack ( myTexturePack ) and I want to change it for different chapters.

myTexturePack = texturepackLoader.loadFromAsset("gfx/chapter1/myGFX.xml", "gfx/chapter1/");
//we load it
myTexturePack.load();

//then we want to change it (*forget unloading stuff)
myTexturePack = texturePackLoader.loadFromAsset("gfx/chapter2/myGFX.xml", "gfx/chapter2/");
myTexturePack.load();

At this point we would aspect to have the graphics from chapter 2 loaded, but this doesn't happen because of the check made in the parser.

final String file = SAXUtils.getAttributeOrThrow(pAttributes, TexturePackParser.TAG_TEXTURE_ATTRIBUTE_FILE);

if(this.mTextureManager.hasMappedTexture(file)) {
    return this.mTextureManager.getMappedTexture(file);
}

The string should contain the whole path not just the filename or there should be a reference somewhere saying that the names of the files must be different.

~korn3l

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions