BonfireGame constructor
BonfireGame({
- required BuildContext context,
- required GameMap map,
- List<
PlayerController> ? playerControllers, - Player? player,
- GameInterface? interface,
- List<
GameComponent> ? components, - List<
GameComponent> ? hudComponents, - GameBackground? background,
- bool debugMode = false,
- bool showCollisionArea = false,
- Color? collisionAreaColor,
- Color? lightingColorGame,
- ValueChanged<
BonfireGame> ? onReady, - Color? backgroundColor,
- GameColorFilter? colorFilter,
- CameraConfig? cameraConfig,
- 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,
);
}