import 'dart:ui';

import 'package:guru_utils/controller/base_controller.dart';
import 'package:guru_utils/visual_feast/engine/visual_feast_engine.dart';

/// Created by Haoyi on 2022/7/12

mixin VisualFeastAware on BaseController {
  final VisualFeastDirector director = VisualFeastDirector();

  void addSprite(String key, VisualFeastSprite sprite) {
    director.addSprite(key, sprite);
  }

  VisualFeastSprite getSprite(String key) {
    return director.getSprite(key);
  }

  void dispatch(VisualFeastEngine engine) {
    director.enqueueEngine(engine);
  }

  void run(VisualFeastEngine engine) {
    director.runEngine(engine);
  }

  VisualFeastEngine createEngine({VoidCallback? onCompleted}) {
    return director.createEngine(onCompleted: onCompleted);
  }

  void disposeDirector() {
    director.dispose();
  }
}
