mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-04 04:47:13 +08:00 
			
		
		
		
	Improving FlareComponent API and updating FlareFlutter dependency
This commit is contained in:
		@ -20,6 +20,12 @@ class FlareComponent extends PositionComponent {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void updateAnimation(String animation) {
 | 
			
		||||
    if (loaded()) {
 | 
			
		||||
      _flareAnimation.updateAnimation(animation);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool loaded() => _flareAnimation != null;
 | 
			
		||||
 | 
			
		||||
@ -31,8 +37,20 @@ class FlareComponent extends PositionComponent {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  void update(double dt) {
 | 
			
		||||
    if (_flareAnimation != null) {
 | 
			
		||||
    if (loaded()) {
 | 
			
		||||
      _flareAnimation.update(dt);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  set width(_width) {
 | 
			
		||||
    super.width = _width;
 | 
			
		||||
    if (loaded()) _flareAnimation.width = width;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  set height(_height) {
 | 
			
		||||
    super.height = _height;
 | 
			
		||||
    if (loaded()) _flareAnimation.height = height;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user