Documentation
¶
Overview ¶
Package blueprint provides common components and interfaces for the Bappa Framework, a game development system based on an entity-component-system (ECS) architecture.
Blueprint serves as the foundation layer of the Bappa Framework, defining standard component types and interfaces that other packages in the framework build upon. It establishes common patterns and data structures used throughout the ecosystem.
Core Concepts ¶
Blueprint defines these key elements:
- Scene: A minimal interface for accessing entities and systems
- CoreSystem: Interface for systems that operate on scenes
- Common component types across various domains
- Predefined queries for frequently used component combinations
Subpackages ¶
Blueprint organizes components by domain into several subpackages:
- blueprint/client: Visual and audio components (sprites, animations, sounds)
- blueprint/input: User interaction components (input buffers)
- blueprint/motion: Physical movement components (dynamics)
- blueprint/spatial: Positioning and geometry components (position, rotation, shapes)
- blueprint/vector: 2D vector mathematics utilities
Working with Queries ¶
The package provides predefined queries for common component combinations:
// Access entities with position components cursor := scene.NewCursor(blueprint.Queries.Position) // Access entities with dynamics components cursor = scene.NewCursor(blueprint.Queries.Dynamics) // Access entities with sprite components cursor = scene.NewCursor(blueprint.Queries.SpriteBundle)
Background Utilities ¶
The package includes functions for creating backgrounds and parallax effects:
// Create a parallax background with multiple layers
builder := blueprint.NewParallaxBackgroundBuilder(storage)
builder.AddLayer("backgrounds/mountains.png", 0.2, 0.0)
builder.AddLayer("backgrounds/clouds.png", 0.5, 0.1)
builder.Build()
// Create a static background
blueprint.CreateStillBackground(storage, "backgrounds/scene.png")
Index ¶
- Variables
- func CreateStillBackground(sto warehouse.Storage, spritePath string, pos ...vector.Two) error
- type CoreSystem
- type ParallaxBackgroundBuilder
- func (b *ParallaxBackgroundBuilder) AddLayer(spritePath string, speedX, speedY float64) *ParallaxBackgroundBuilder
- func (b *ParallaxBackgroundBuilder) Build() error
- func (b *ParallaxBackgroundBuilder) WithDisableLooping(disable bool) *ParallaxBackgroundBuilder
- func (b *ParallaxBackgroundBuilder) WithOffset(offset vector.Two) *ParallaxBackgroundBuilder
- type ParallaxLayer
- type Plan
- type Scene
Constants ¶
This section is empty.
Variables ¶
var Queries defaultQueries = defaultQueries{}
Functions ¶
Types ¶
type CoreSystem ¶
type ParallaxBackgroundBuilder ¶
type ParallaxBackgroundBuilder struct {
// contains filtered or unexported fields
}
ParallaxBackgroundBuilder provides a fluent API for creating parallax backgrounds
func NewParallaxBackgroundBuilder ¶
func NewParallaxBackgroundBuilder(sto warehouse.Storage) *ParallaxBackgroundBuilder
NewParallaxBackgroundBuilder creates a new builder for parallax backgrounds
func (*ParallaxBackgroundBuilder) AddLayer ¶
func (b *ParallaxBackgroundBuilder) AddLayer(spritePath string, speedX, speedY float64) *ParallaxBackgroundBuilder
AddLayer adds a new layer to the parallax background
func (*ParallaxBackgroundBuilder) Build ¶
func (b *ParallaxBackgroundBuilder) Build() error
Build generates all layers and creates the parallax background
func (*ParallaxBackgroundBuilder) WithDisableLooping ¶
func (b *ParallaxBackgroundBuilder) WithDisableLooping(disable bool) *ParallaxBackgroundBuilder
WithDisableLooping sets whether background looping should be disabled
func (*ParallaxBackgroundBuilder) WithOffset ¶
func (b *ParallaxBackgroundBuilder) WithOffset(offset vector.Two) *ParallaxBackgroundBuilder
WithOffset sets an optional position offset for the entire background
type ParallaxLayer ¶
type ParallaxLayer struct {
// SpritePath is the path to the sprite resource
SpritePath string
// SpeedX is the horizontal parallax speed multiplier
SpeedX float64
// SpeedY is the vertical parallax speed multiplier
SpeedY float64
}
ParallaxLayer defines a single layer in a parallax background