onLoad method
- dynamic func(
- Texture texture
Registers a callback function to be executed when the texture has finished loading.
If the texture is already loaded (isLoading is false
), the callback is executed immediately.
func
: The function to call, receiving the loaded Texture as an argument.
Implementation
void onLoad(Function(Texture texture) func) {
if (isLoading) {
_onLoad.add(func);
} else {
func(this);
}
}