axe

package
v0.0.0-...-20810c9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[V any](r ReflectRegistry) (V, bool)

times, ok := axe.Get[axe.Times](game)

func Load

func Load[M any](s *Store, model M, view string) M

func ORM

func ORM()

func TypeOf

func TypeOf[V any]() reflect.Type

Types

type AssetSystem

type AssetSystem interface{}

type AudioSystem

type AudioSystem interface {
	GameSystem
}

type Camera

type Camera interface {
}

type Contact

type Contact struct {
	Table    `t:"Contacts" pk:"ContactID"`
	ID       string              `c:"ContactID"`
	Name     string              `c:"ContactName"`
	Employee ManyToOne[Employee] `c:"EmpID"`
}

type DebugEvent

type DebugEvent struct {
	Id       int
	Name     string
	Parent   *DebugEvent
	Depth    int
	Children []*DebugEvent
	Sibling  *DebugEvent
}

type DebugGraph

type DebugGraph struct {
	Placement ui.Placement
	Database  *StatDatabase
	Set       *StatSet
}

type DebugLog

type DebugLog struct {
	Severity int
	Message  string
	Data     any
}

type DebugProfiler

type DebugProfiler struct{}

func (*DebugProfiler) Begin

func (prof *DebugProfiler) Begin(ev string)

func (*DebugProfiler) End

func (prof *DebugProfiler) End()

type DebugSnapshot

type DebugSnapshot struct {
	At      time.Time
	Elapsed time.Duration
}

type DebugSystem

type DebugSystem struct {
	Logs      []DebugLog
	Snapshots []DebugSnapshot
	Graphs    []DebugGraph
	Events    []DebugEvent
	Enabled   bool
}

type Employee

type Employee struct {
	Table    `t:"Employees" pk:"EmpID"`
	ID       string             `c:"EmpID"`
	Name     string             `c:"EmpName" v:"*"`
	DOB      time.Time          `c:"DOB" v:"basic"`
	User     OneToOne[User]     `fc:"UserID"`
	Contacts OneToMany[Contact] `fc:"EmpID"`
}

type EventSystem

type EventSystem interface{}

type Game

type Game struct {
	Debug    DebugSystem
	Assets   AssetSystem
	Windows  WindowSystem
	Graphics GraphicsSystem
	Input    InputSystem
	Actions  input.ActionSets
	Audio    AudioSystem
	Events   EventSystem
	Stages   StageManager
	State    GameState
	Settings GameSettings
	Running  bool
}

type GameSettings

type GameSettings struct {
	Name                 string
	EnableDebug          bool
	FixedUpdateFrequency time.Duration
	FixedDrawFrequency   time.Duration
	FirstStage           string
	JobGroups            int
	JobBudget            int
	Stages               []Stage
	Assets               []asset.Ref
	Windows              []StageWindow
	WorldName            string
	WorldSettings        ecs.WorldSettings
}

type GameState

type GameState struct {
	StartTime   time.Time
	Times       []GameTime
	UpdateTimer Timer
	DrawTimer   Timer
}

type GameSystem

type GameSystem interface {
	Init(game *Game) error
	Update(game *Game)
	Destroy()
}

type GameTime

type GameTime struct {
	Name        string
	DayDuration time.Duration
	Enabled     bool
	Scale       float32
	DateTime    time.Time
	Elapsed     time.Duration
	StartTime   time.Time
}

type Graphics

type Graphics interface {
	Draw()
}

type GraphicsSystem

type GraphicsSystem interface {
	GameSystem
}

type InputSystem

type InputSystem interface {
	GameSystem
	input.InputSystem
}

type ManyToOne

type ManyToOne[V any] struct {
	// contains filtered or unexported fields
}

func (ManyToOne[V]) Get

func (fk ManyToOne[V]) Get() V

type Matrix

type Matrix struct{}

type ORMView

type ORMView struct {
	Fields []ORMViewField
}

type ORMViewField

type ORMViewField struct {
	Field   string
	SubView string
}

type OneToMany

type OneToMany[V any] struct {
	// contains filtered or unexported fields
}

func (OneToMany[V]) Get

func (m OneToMany[V]) Get() []V

type OneToOne

type OneToOne[V any] struct {
	// contains filtered or unexported fields
}

func (OneToOne[V]) Get

func (fk OneToOne[V]) Get() V

type Order

type Order struct {
	Field string
	Desc  bool
}

type Query

type Query struct {
	Query  QueryLogic
	Offset *uint
	Limit  *uint
	Order  []Order
}

type QueryLogic

type QueryLogic interface {
	BuildQuery(q SQL) (SQL, error)
}

type ReflectRegistry

type ReflectRegistry interface {
	Get(t reflect.Type) any
	Set(t reflect.Type, value any)
}

type Results

type Results[V any] interface {
	Offset() uint
	Limit() uint
	Total() uint
	Next() (V, error)
	Close()
}

type SQL

type SQL string

type Scene

type Scene struct {
	Name   string
	Jobs   *job.JobRunner
	World  *ecs.World
	Space  Space
	Enable func(scene *Scene, game *Game)
	Load   func(scene *Scene, game *Game)
}

type Screen

type Screen interface {
	Size() geom.Vec2i
	Position() geom.Vec2i
}

type Shape

type Shape interface {
	Finite() bool
	Distance(point SpaceCoord) float32
	Normal(point SpaceCoord, out *SpaceCoord) bool
	Raytrace(point SpaceCoord, direction SpaceCoord) bool
}

type Space

type Space interface {
	GameSystem
	Collisions(flags util.Match[int], callback SpaceCollisionCallback)
	Intersects(query SpaceQuery, callback SpaceSearchCallback) int
	Contains(query SpaceQuery, callback SpaceSearchCallback) int
	Raytrace(query SpaceQuery, callback SpaceSearchCallback) int
	KNN(query SpaceQuery, nearest []SpaceNearest, nearestCount *int)
}

type SpaceCollisionCallback

type SpaceCollisionCallback func(subject any, otherSubject any, overlap float32, index int, second bool)

type SpaceComponent

type SpaceComponent struct {
	Shape          Shape
	Offset         SpaceCoord
	WorldTransform *Matrix
	Flags          int
	Static         bool
	Inert          bool
}

type SpaceCoord

type SpaceCoord interface {
	To2d() (x float32, y float32)
	To3d() (x float32, y float32, z float32)
}

type SpaceNearest

type SpaceNearest struct {
	Entity   any
	Distance float32
}

type SpaceQuery

type SpaceQuery struct {
	Point   SpaceCoord
	End     SpaceCoord
	Shape   Shape
	Maximum int
	Flags   util.Match[int]
}

type SpaceSearchCallback

type SpaceSearchCallback func(entity any, overlap float32, index int, query SpaceQuery) bool

type Stage

type Stage struct {
	Name    string
	Assets  []asset.Ref
	Windows []StageWindow
	Scenes  []Scene
	Views   []View
	Actions input.ActionSets
}

type StageManager

type StageManager struct {
	Stages  map[string]*Stage
	Current *Stage
	Next    *Stage
}

type StageWindow

type StageWindow struct {
	Name       string
	Title      string
	Placement  ui.Placement
	Fullscreen bool
}

type StatDatabase

type StatDatabase struct {
	Name    string
	Updated time.Time
	Visible bool
	Event   *DebugEvent
	Enabled bool
	Sets    []StatSet
}

type StatPoint

type StatPoint struct {
	Total int
	Sum   float64
	Min   float64
	Max   float64
}

type StatSet

type StatSet struct {
	Index        int
	Description  string
	Interval     time.Duration
	PointerTime  time.Time
	PointerIndex int
	Points       []StatPoint
}

type Storage

type Storage[E any, PK comparable] interface {
	Get(ctx context.Context, pk PK) (E, error)
	Create(ctx context.Context, e E) (PK, error)
	Update(ctx context.Context, e E, pk PK) error
	Delete(ctx context.Context, pk PK) error

	Search(ctx context.Context, q Query) (Results[E], error)
	First(ctx context.Context, q Query) (*E, error)
	All(ctx context.Context, q Query) ([]E, error)
	Exists(ctx context.Context, q Query) (bool, error)
}

type Store

type Store struct{}

type Table

type Table struct{}

type Timer

type Timer struct {
	LastTick  time.Time
	Current   time.Time
	Elapsed   time.Duration
	Frequency time.Duration
	Ticks     int64
}

type User

type User struct {
	Table    `t:"Users" pk:"UserID"`
	ID       string             `c:"UserID"`
	Name     string             `c:"EmpName" v:"*"` // on all views
	Email    string             `c:"Email" v:"withEmail,withEmployee"`
	Employee OneToOne[Employee] `c:"EmpID" v:"withEmployee(basic)"` // just on this view
}

User{ID: 23}.Load(ctx, UserViewEmployee)

type View

type View interface {
	GameSystem
	Name() string
	Scene() Scene
	Camera() Camera
	Placement() ui.Placement
}

type Window

type Window interface {
	Name() string
	Title() react.Value[string]
	Placement() ui.Placement
	Screen() Screen
	Size() geom.Vec2i
}

type WindowSystem

type WindowSystem interface {
	GameSystem
	MainWindow() Window
	Windows() []Window
	Screens() []Screen
}

Jump to

Keyboard shortcuts

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