bonfire library Null safety

Classes

Aabb2
Defines a 2-dimensional axis-aligned bounding box between a min and a max position.
Aabb3
Defines a 3-dimensional axis-aligned bounding box between a min and a max position.
AcceleratedParticle
A particle that serves as a container for basic acceleration physics.
Ally
Created by
Anchor
Represents a relative position inside some 2D object with a rectangular size or bounding box.
AnimatedFollowerObject
AnimatedObjectOnce
ArcLightingType
BackgroundColorGame
Used to define color of the background
BatchItem
A single item in a SpriteBatch.
Block
This is just a pair of <int, int>.
BonfireGame
Is a customGame where all magic of the Bonfire happen.
BonfireInjector
Class used to manager dependencies
BonfireTiledWidget
BonfireWidget
CameraConfig
Class use to configure camera behavior.
CircleComponent
CircleLightingType
CircleParticle
Plain circle with no other behaviors.
CircleShape
CollisionArea
CollisionConfig
ColorEffect
Change the color of a component over time.
Component
Components are the basic building blocks for your game.
ComponentEffect<T extends Component>
Base class for effects that target a Component of type T.
ComponentParticle
ComponentSet
This is a simple wrapper over QueryableOrderedSet to be used by Component.
ComposedParticle
A single Particle which manages multiple children by proxying all lifecycle hooks.
ComputedParticle
An abstract Particle container which delegates rendering outside Allows to implement very interesting scenarios from scratch.
CurvedEffectController
A controller that grows non-linearly from 0 to 1 following the provided curve. The duration cannot be 0.
CurvedParticle
A Particle which applies certain Curve for easing or other purposes to its progress getter.
CustomPainterComponent
A PositionComponent that renders a CustomPainter at the designated position, scaled to have the designated size and rotated to the specified angle.
DelayedEffectController
An effect controller that waits for delay seconds before running the child controller. While waiting, the progress will be reported at 0.
DurationEffectController
Abstract class for an effect controller that has a predefined duration.
Effect
An Effect is a component that changes properties or appearance of another component over time.
EffectController
Base "controller" class to facilitate animation of effects.
Enemy
It is used to represent your enemies.
Flame
This class holds static references to some useful objects to use in your game.
FlyingAttackObject
FollowerWidget
With this widget you can add a widget what follows a component in the game.
Frustum
Defines a frustum constructed out of six Planes.
GameBackground
Base to create your custom game background
GameColorFilter
GameComponent
Base of the all components in the Bonfire
GameController
GameDecoration
This component represents anything you want to add to the scene, it can be a simple "barrel" halfway to an NPC that you can use to interact with your player.
GameDecorationWithCollision
GameDecoration with collision used in construct of the map with Tiled
GameInterface
The way you cand raw things like life bars, stamina and settings. In another words, anything that you may add to the interface to the game.
GameListener
ImageParticle
A Particle which renders given Image on a Canvas image is centered. If any other behavior is needed, consider using ComputedParticle.
InfiniteEffectController
Effect controller that wraps a child effect controller and repeats it infinitely.
InterfaceComponent
Component used to add in your GameInterface
IntersectionResult
Defines a result of an intersection test.
IntervalTick
IsometricTileMapComponent
This component renders a tilemap, represented by an int matrix, given a tileset, in which the integers are the block ids.
Joystick
JoystickAction
JoystickActionEvent
JoystickController
JoystickDirectional
JoystickDirectionalEvent
JoystickMoveToPosition
KeyboardConfig
LayerPriority
LightingConfig
Class used to configure lighting
LightingType
Created by
LinearEffectController
A controller that grows linearly from 0 to 1 over duration seconds.
MapGame
MapWorld
Matrix2
2D Matrix. Values are stored in column major order.
Matrix3
3D Matrix. Values are stored in column major order.
Matrix4
4D Matrix. Values are stored in column major order.
MoveAlongPathEffect
This effect will move the target along the specified path, which may contain curved segments, but must be simply-connected.
MoveEffect
Move a component to a new position.
MovingParticle
Statically move given child Particle by given Vector2.
NineTileBox
This allows you to create a rectangle textured with a 9-sliced image.
NineTileBoxComponent
This class is a thin wrapper on top of NineTileBox as a component.
NineTileBoxWidget
A StatelessWidget that renders NineTileBox
NoiseEffectController
Effect controller that oscillates around 0 following a noise curve.
Npc
Created by
Obb3
Defines a 3-dimensional oriented bounding box defined with a center, halfExtents and axes.
OpacityEffect
Change the opacity of a component over time.
PaintParticle
A particle which renders its child with certain Paint Could be used for applying composite effects. Be aware that any composite operation is relatively expensive, as involves copying portions of GPU memory. The less pixels copied, the faster it'll be.
ParallaxComponent<T extends FlameGame>
A full parallax, several layers of images drawn out on the screen and each layer moves with different velocities to give an effect of depth.
Particle
Base class implementing common behavior for all the particles.
ParticleComponent
Base container for Particle instances to be attach to a Component tree. Could be added either to FlameGame or an implementation of Component. Proxies Component lifecycle hooks to nested Particle.
ParticleSystemComponent
{@template particle_system_component} A PositionComponent that renders a Particle at the designated position, scaled to have the designated size and rotated to the specified angle. {endtempalte}
PauseEffectController
A controller that keeps constant progress over duration seconds.
Plane
Player
PolygonComponent
PolygonShape
PositionComponent
A Component implementation that represents an object that can be freely moved around the screen, rotated, and scaled.
PositionProvider
Interface for a component that can be affected by move effects.
Quad
Defines a quad by four points.
Quaternion
Defines a Quaternion (a four-dimensional vector) for efficient rotation calculations.
RandomEffectController
An EffectController that wraps another effect controller child and randomizes its duration after each reset.
RandomVariable
RandomVariable is an object capable of producing random values with the prescribed distribution function. Each distribution is implemented within its own derived class.
Ray
Defines a Ray by an origin and a direction.
RectangleComponent
RectangleShape
RemoveEffect
This simple effect, when attached to a component, will cause that component to be removed from the game tree after delay seconds.
RepeatedEffectController
Effect controller that repeats child controller a certain number of times.
ReverseCurvedEffectController
A controller that grows non-linearly from 1 to 0 following the provided curve. The duration cannot be 0.
ReverseLinearEffectController
A controller that grows linearly from 1 to 0 over duration seconds.
RotateEffect
Rotate a component around its anchor.
RotatingParticle
A particle which rotates its child over the lifespan between two given bounds in radians
RotationAlly
Created by
RotationEnemy
Enemy used for top-down perspective
RotationNpc
Created by
RotationPlayer
Say
ScaledParticle
A particle which rotates its child over the lifespan between two given bounds in radians
ScaleEffect
Scale a component.
ScreenHitbox<T extends FlameGame>
This component is used to detect hitboxes colliding into the edges of the viewport of the game.
SequenceEffect
Run multiple effects in a sequence, one after another.
SequenceEffectController
An effect controller that executes a list of other controllers one after another.
ShapeComponent
A shape can represent any geometrical shape with optionally a size, position and angle. It can also have an anchor if it shouldn't be rotated around its center. A point can be determined to be within of outside of a shape.
SimpleAlly
Created by
SimpleDirectionAnimation
Class responsible to manager animation on SimplePlayer and SimpleEnemy
SimpleEnemy
Enemy with animation in all direction
SimpleNpc
Created by
SimplePlayer
SimplexNoise
SineEffectController
This effect controller follows a sine wave.
SizeEffect
Change the size of a component over time.
SpeedEffectController
This controller can force execution of an effect at a predefined speed.
Sphere
Defines a sphere with a center and a radius.
Sprite
A Sprite is a region of an Image that can be rendered in the Canvas.
SpriteAnimation
Represents a sprite animation, that is, a list of sprites that change with time.
SpriteAnimationComponent
SpriteAnimationData
SpriteAnimationFrame
Represents a single sprite animation frame.
SpriteAnimationFrameData
SpriteAnimationGroupComponent<T>
SpriteAnimationParticle
SpriteAnimationWidget
A StatelessWidget that renders a SpriteAnimation
SpriteBatch
The SpriteBatch API allows for rendering multiple items at once.
SpriteBatchComponent
SpriteButton
A StatelessWidget that uses SpriteWidgets to render a pressable button
SpriteComponent
A PositionComponent that renders a single Sprite at the designated position, scaled to have the designated size and rotated to the specified angle.
SpriteGroupComponent<T>
A PositionComponent that can have mutiple Sprites and render the one mapped with the current key.
SpriteParticle
SpriteSheet
Utility class to help extract animations and sprites from a sprite sheet image.
SpriteWidget
A StatelessWidget which renders a Sprite To render an animation, use SpriteAnimationWidget.
StateController<T extends GameComponent>
Created by
StateControllerConsumer<T extends StateController<GameComponent>>
TalkDialog
TextBoxComponent<T extends TextRenderer>
TextBoxConfig
A set of configurations for the TextBoxComponent itself, as opposed to the TextRenderer, which contains the configuration for how to render the text only (font size, color, family, etc).
TextComponent<T extends TextRenderer>
TextDamageComponent
TextInterfaceComponent
Component used to add Text in your GameInterface
TextPaint
It does not hold information regarding the position of the text to be rendered, nor does it contain the text itself (the string). To use that information, use the TextComponent, which uses TextPaint.
TextRenderer
TextRenderer is the abstract API that Flame uses for rendering text. This class can be extended to provide another implementation of text rendering in the engine.
Tile
TiledWorldMap
TileModel
TileModelAnimation
TileModelSprite
TileWithCollision
Timer
Simple utility class that helps handling time counting and implementing interval like events.
TimerComponent
A component that uses a Timer instance which you can react to when it has finished.
Transform2DEffect
Base class for effects that target a Transform2D property.
TranslatedParticle
Statically offset given child Particle by given Vector2.
Triangle
Defines a triangle by three points.
ValueGeneratorComponent
Component used to generate numbers using the gameLoop.
Vector
Base class for vectors
Vector2
2D column vector.
Vector3
3D column vector.
Vector4
4D column vector.
ZigzagEffectController
This effect controller goes from 0 to 1, then back to 0, then to -1, and then again to 0.

Mixins

Attackable
Mixin responsible for adding damage-taking behavior to the component.
AutomaticRandomMovement
Mixin responsible for adding random movement like enemy walking through the scene
BonfireHasGameRef
Draggable
DragGesture
EffectTarget<T>
Mixin adds field target of type T to an Effect. The target can be either set explicitly by the effect class, or acquired automatically from the effect's parent when mounting.
Follower
Created by
GestureHitboxes
This mixin can be used if you want to use hitboxes to determine whether a gesture is within the Component or not.
HasCollisionDetection
Keeps track of all the ShapeHitboxs in the component tree and initiates collision detection every tick.
HasPaint<T extends Object>
Adds a collection of paints to a component
Hoverable
JoystickListener
KeyboardHandler
A Component mixin to add keyboard handling capability to components. Must be used in components that can only be added to games that are mixed with HasKeyboardHandlerComponents.
Lighting
Mixin used to configure lighting in your component
MouseGesture
Mixin responsible to listen mouse gestures
Movement
Mixin responsible for adding movements
MovementByJoystick
Mixin responsible for adding movements through joystick events
MoveToPositionAlongThePath
Mixin responsible for find path using a_star_algorithm and moving the component through the path
ObjectCollision
Mixin responsible for adding collision
Pushable
Created by
Sensor
Mixin responsible for adding trigger to detect other objects above
SingleChildParticle
Implements basic behavior for nesting Particle instances into each other.
TapGesture
Tappable
UseAssetsLoader
Created by
UseSprite
Created by
UseSpriteAnimation
Created by
UseStateController<T extends StateController<GameComponent>>
Created by

Extensions

AllyExtensions
Created by
AttackableExtensions
CameraExt
ComponentExt
EnemyExtensions
Functions util to use in your Enemy
FutureSpriteAnimationExt
FutureSpriteExt
GameComponentExt
GameComponentExtensions
ImageExtension
JoystickDirectionalEventExtention
MovementExtensions
NpcExtensions
Created by
NullableExt
ObjectExt
OffSetExt
ParallaxComponentExtension
PlayerExtensions
RectExt
RotationEnemyExtensions
RotationPlayerExtensions
SpriteBatchExtension
SpriteExt
SpriteFutureExt
Vector2Ext
Vector2Extension

Constants

degrees2Radians → const double
Constant factor to convert and angle from degrees to radians.
math.pi / 180.0
radians2Degrees → const double
Constant factor to convert and angle from radians to degrees.
180.0 / math.pi

Properties

sensorColor Color
final

Functions

absoluteError(dynamic calculated, dynamic correct) double
Returns absolute error between calculated and correct. The type of calculated and correct must match and can be any vector, matrix, or quaternion.
buildPlaneVectors(Vector3 planeNormal, Vector3 u, Vector3 v) → void
Sets u and v to be two vectors orthogonal to each other and planeNormal.
catmullRom(double edge0, double edge1, double edge2, double edge3, double amount) double
Do a catmull rom spline interpolation with edge0, edge1, edge2 and edge3 by amount.
cross2(Vector2 x, Vector2 y) double
2D cross product. vec2 x vec2.
cross2A(double x, Vector2 y, Vector2 out) → void
2D cross product. double x vec2.
cross2B(Vector2 x, double y, Vector2 out) → void
2D cross product. vec2 x double.
cross3(Vector3 x, Vector3 y, Vector3 out) → void
3D Cross product.
degrees(double radians) double
Convert radians to degrees.
dot2(Vector2 x, Vector2 y) double
2D dot product.
dot3(Vector3 x, Vector3 y) double
3D dot product.
getRectAndCollision(GameComponent? comp) Rect
Gets player position used how base in calculations
makeFrustumMatrix(double left, double right, double bottom, double top, double near, double far) Matrix4
Constructs a new OpenGL perspective projection matrix.
makeInfiniteMatrix(double fovYRadians, double aspectRatio, double zNear) Matrix4
Constructs a new OpenGL infinite projection matrix.
makeOrthographicMatrix(double left, double right, double bottom, double top, double near, double far) Matrix4
Constructs a new OpenGL orthographic projection matrix.
makePerspectiveMatrix(double fovYRadians, double aspectRatio, double zNear, double zFar) Matrix4
Constructs a new OpenGL perspective projection matrix.
makePlaneProjection(Vector3 planeNormal, Vector3 planePoint) Matrix4
Returns a transformation matrix that transforms points onto the plane specified with planeNormal and planePoint.
makePlaneReflection(Vector3 planeNormal, Vector3 planePoint) Matrix4
Returns a transformation matrix that transforms points by reflecting them through the plane specified with planeNormal and planePoint.
makeViewMatrix(Vector3 cameraPosition, Vector3 cameraFocusPosition, Vector3 upDirection) Matrix4
Constructs a new OpenGL view matrix.
mix(double min, double max, double a) double
Interpolate between min and max with the amount of a using a linear interpolation. The computation is equivalent to the GLSL function mix.
pickRay(Matrix4 cameraMatrix, num viewportX, num viewportWidth, num viewportY, num viewportHeight, num pickX, num pickY, Vector3 rayNear, Vector3 rayFar) bool
On success, rayNear and rayFar are the points where the screen space pickX, pickY intersect with the near and far planes respectively.
radians(double degrees) double
Convert degrees to radians.
relativeError(dynamic calculated, dynamic correct) double
Returns relative error between calculated and correct. The type of calculated and correct must match and can be any vector, matrix, or quaternion.
renderSpriteByRadAngle(Canvas canvas, double radAngle, Rect position, Sprite sprite, {double opacity = 1.0}) → void
setFrustumMatrix(Matrix4 perspectiveMatrix, double left, double right, double bottom, double top, double near, double far) → void
Constructs an OpenGL perspective projection matrix in perspectiveMatrix.
setInfiniteMatrix(Matrix4 infiniteMatrix, double fovYRadians, double aspectRatio, double zNear) → void
Constructs an OpenGL infinite projection matrix in infiniteMatrix. fovYRadians specifies the field of view angle, in radians, in the y direction. aspectRatio specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio of x (width) to y (height). zNear specifies the distance from the viewer to the near plane (always positive).
setModelMatrix(Matrix4 modelMatrix, Vector3 forwardDirection, Vector3 upDirection, double tx, double ty, double tz) → void
Constructs an OpenGL model matrix in modelMatrix. Model transformation is the inverse of the view transformation. Model transformation is also known as "camera" transformation. Model matrix is commonly used to compute a object location/orientation into the full model-view stack.
setOrthographicMatrix(Matrix4 orthographicMatrix, double left, double right, double bottom, double top, double near, double far) → void
Constructs an OpenGL orthographic projection matrix in orthographicMatrix.
setPerspectiveMatrix(Matrix4 perspectiveMatrix, double fovYRadians, double aspectRatio, double zNear, double zFar) → void
Constructs an OpenGL perspective projection matrix in perspectiveMatrix.
setRotationMatrix(Matrix4 rotationMatrix, Vector3 forwardDirection, Vector3 upDirection) → void
Constructs a rotation matrix in rotationMatrix.
setViewMatrix(Matrix4 viewMatrix, Vector3 cameraPosition, Vector3 cameraFocusPosition, Vector3 upDirection) → void
Constructs an OpenGL view matrix in viewMatrix. View transformation is the inverse of the model transformation. View matrix is commonly used to compute the camera location/orientation into the full model-view stack.
smoothStep(double edge0, double edge1, double amount) double
Do a smooth step (hermite interpolation) interpolation with edge0 and edge1 by amount. The computation is equivalent to the GLSL function smoothstep.
unproject(Matrix4 cameraMatrix, num viewportX, num viewportWidth, num viewportY, num viewportHeight, num pickX, num pickY, num pickZ, Vector3 pickWorld) bool
On success, Sets pickWorld to be the world space position of the screen space pickX, pickY, and pickZ.

Enums

ActionEvent
AttackFromEnum
Direction
DirectionTextDamage
JoystickActionAlign
JoystickDirection
JoystickMoveDirectional
KeyboardDirectionalType
LifecycleState
This enum keeps track of the Component's current stage in its lifecycle.
PersonSayDirection
PositionType
Used to define which coordinate system a given top-level component respects.
ReceivesAttackFromEnum
SimpleAnimationEnum

Typedefs

BuildDependency<T> = T Function(BonfireInjector i)
Created by
ComponentSetFactory = ComponentSet Function()
ObjectBuilder = GameComponent Function(TiledObjectProperties properties)
ParticleGenerator = Particle Function(int)
A function which returns a Particle when called.
ParticleRenderDelegate = void Function(Canvas c, Particle particle)
A function which should render desired contents onto a given canvas. External state needed for rendering should be stored elsewhere, so that this delegate could use it
StateControllerWidgetBuilder<T> = Widget Function(BuildContext context, T controller)
Created by