herd

package module
v0.0.0-...-f00212e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2023 License: LGPL-3.0 Imports: 5 Imported by: 2

README

Herd

Herd is an let another ECS framework for go language with Ebitengine integrations

Design decisions

  • Avoid dependency injection
  • Use sparse sets as storage
  • Use reflect for preparing a new query
  • Use unsafe for access and add new entities and components on it

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Manager    *Manager
	SystemInfo *SystemInfo
	// contains filtered or unexported fields
}

An App incapsulated all game logic and rendering. An App provides methods to adding systems and renderers and also implements ebiten.Game interface

func NewApp

func NewApp() *App

NewApp returns a new App instance

func (*App) AddRenderers

func (app *App) AddRenderers(renderers ...Renderer) error

func (*App) AddStartups

func (app *App) AddStartups(startups ...Startup) error

func (*App) AddSystems

func (app *App) AddSystems(systems ...System) error

func (*App) Draw

func (app *App) Draw(screen *ebiten.Image)

func (*App) Layout

func (app *App) Layout(w, h int) (int, int)

func (*App) Update

func (app *App) Update() error

type EntityID

type EntityID int

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func (*Manager) Spawn

func (c *Manager) Spawn(bundle any)

type Query

type Query[T any] struct {
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery[T any](app *App) (Query[T], error)

func (Query[T]) ForEach

func (q Query[T]) ForEach(f func(t *T))

func (Query[T]) Iterate

func (q Query[T]) Iterate(f func(id EntityID, t *T) bool)

type Renderer

type Renderer func(*ebiten.Image)

Renderer is a system that draws something every frame

type Startup

type Startup func() (bool, error)

Startup is a initilize system that updates after App started. Startup system should return (true, nil) when initialisation finished successul

type System

type System func() error

System is a basic system that updates every tick after App initialization is finished

type SystemInfo

type SystemInfo struct {
	Entities int
	Bounds   image.Rectangle
}

Directories

Path Synopsis
examples
bunnymark Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL