BonfireGame constructor

BonfireGame({
  1. required BuildContext context,
  2. required GameMap map,
  3. List<PlayerController>? playerControllers,
  4. Player? player,
  5. GameInterface? interface,
  6. List<GameComponent>? components,
  7. List<GameComponent>? hudComponents,
  8. GameBackground? background,
  9. bool debugMode = false,
  10. bool showCollisionArea = false,
  11. Color? collisionAreaColor,
  12. Color? lightingColorGame,
  13. ValueChanged<BonfireGame>? onReady,
  14. Color? backgroundColor,
  15. GameColorFilter? colorFilter,
  16. CameraConfig? cameraConfig,
  17. List<Force2D>? globalForces,
})

Implementation

BonfireGame({
  required this.context,
  required this.map,
  this.playerControllers,
  this.player,
  this.interface,
  List<GameComponent>? components,
  List<GameComponent>? hudComponents,
  this.background,
  bool debugMode = false,
  this.showCollisionArea = false,
  this.collisionAreaColor,
  this.lightingColorGame,
  this.onReady,
  Color? backgroundColor,
  GameColorFilter? colorFilter,
  CameraConfig? cameraConfig,
  List<Force2D>? globalForces,
})  : globalForces = globalForces ?? [],
      super(
        camera: BonfireCamera(
          config: cameraConfig,
          viewport: _getViewPort(cameraConfig),
          backdrop: background,
          hudComponents: [
            LightingComponent(
              color: lightingColorGame ?? const Color(0x00000000),
            ),
            ColorFilterComponent(
              colorFilter ?? GameColorFilter(),
            ),
            ...playerControllers ?? [],
            if (interface != null) interface,
            ...hudComponents ?? []
          ],
        ),
        world: World(
          children: [
            map,
            if (player != null) player,
            ...components ?? [],
          ],
        ),
      ) {
  this.debugMode = debugMode;
  _bgColor = backgroundColor;

  _intervalUpdateOder = IntervalTick(
    INTERVAL_UPDATE_ORDER,
    onTick: _updateOrderPriorityMicrotask,
  );
  _intervalOprimizeTree = IntervalTick(
    INTERVAL_OPTIMIZE_TREE,
    onTick: _optimizeCollisionTree,
  );
}