Originally Posted by
kippie
@
Omar @
Rebecca
Code:
// Add these to your interface class
public static RSInterface createSprite(final int parentIndex, final int index, final String disabled, final String enabled) {
final Sprite disabledSprite = Sprite.fetchSprite(disabled);
final Sprite enabledSprite = Sprite.fetchSprite(enabled);
final RSInterface sprite = instances[index] = new RSInterface();
sprite.id = index;
sprite.parent = parentIndex;
sprite.type = 5;
sprite.width = disabledSprite.width;
sprite.height = disabledSprite.height;
sprite.disabledSprite = disabledSprite;
sprite.enabledSprite = enabledSprite;
return sprite;
}
I dont have a "Sprite.fetchSprite" or any method with just 1 param in Sprite.
I believe that was just a wrapper for this method:
getImage()
Code:
public static Image24 getImage(int id, FileArchive media, String name) {
long uid = (StringUtil.hashCode(name) << 8) + (long) id;
Image24 image = imageCache.get(uid);
if (image != null) {
return image;
}
try {
image = new Image24(media, name, id);
imageCache.put(uid, image);
} catch (Exception _ex) {
return null;
}
return image;
}
public static Image24 getImage(final String image, final FileArchive media) {
final int index = image.lastIndexOf(",");
return getImage(Integer.parseInt(image.substring(index + 1)), media, image.substring(0, index));
}
public static Image24 getImage(final String image) {
return getImage(image, Component.media);
}
With "Component.media" being the media archive passed in the interface decoder: unpack()
Many clients are modified to just store a reference to that somewhere: