Documentation ¶
Index ¶
- Constants
- type AssetServer
- type ComponentDefinition
- func (c *ComponentDefinition[T]) Get(entity *EntityInstance) *T
- func (c *ComponentDefinition[T]) Id() ID
- func (c *ComponentDefinition[T]) In(entity *EntityInstance) bool
- func (c *ComponentDefinition[T]) Name() string
- func (c *ComponentDefinition[T]) New() any
- func (c *ComponentDefinition[T]) Type() reflect.Type
- type ComponentOptions
- type Components
- type Debug
- type EntityDefinition
- func (e *EntityDefinition) AddComponent(c IComponent) bool
- func (e *EntityDefinition) Components() []IComponent
- func (e *EntityDefinition) HasComponent(c IComponent) bool
- func (e *EntityDefinition) Id() ID
- func (e *EntityDefinition) New() *EntityInstance
- func (e *EntityDefinition) RemoveComponent(c IComponent)
- type EntityInstance
- type EntityOptions
- type Game
- type Handler
- type IComponent
- type ID
- type IPlugin
- type IQuery
- type IService
- type Plugin
- type QueryDefinition
- type Rect
- func (r Rect) Bottom() float64
- func (r Rect) Center() Vec2
- func (r Rect) Contains(v Vec2) bool
- func (r Rect) Expand(v Vec2) Rect
- func (r Rect) ExpandS(s float64) Rect
- func (r Rect) Intersect(r2 Rect) Rect
- func (r Rect) Intersects(r2 Rect) bool
- func (r Rect) Left() float64
- func (r Rect) Max() Vec2
- func (r Rect) Min() Vec2
- func (r Rect) Right() float64
- func (r Rect) Shrink(v Vec2) Rect
- func (r Rect) ShrinkS(s float64) Rect
- func (r Rect) Top() float64
- func (r Rect) Union(r2 Rect) Rect
- type RenderLayer
- type Renderer
- type Screen
- func (s *Screen) Clear()
- func (s *Screen) GetColor() color.Color
- func (s *Screen) GetPosition() Vec2
- func (s *Screen) GetRotation() float64
- func (s *Screen) GetSize() Vec2
- func (s *Screen) GetZoom() float64
- func (s *Screen) GetZoomLimits() (float64, float64)
- func (s *Screen) Move(x, y float64)
- func (s *Screen) Rotate(rotation float64)
- func (s *Screen) ScreenPositionToWorld(x, y int) (float64, float64)
- func (s *Screen) SetColor(color color.Color)
- func (s *Screen) SetPosition(x, y float64)
- func (s *Screen) SetRotation(rotation float64)
- func (s *Screen) SetSize(w, h float64)
- func (s *Screen) SetZoom(zoom float64)
- func (s *Screen) SetZoomLimits(min, max float64)
- func (s *Screen) WorldPositionToScreen(x, y float64) (int, int)
- func (s *Screen) Zoom(zoom float64)
- type ServiceDefinition
- type SystemDefinition
- type SystemFn
- type SystemOptions
- type Texture
- type Timer
- type Vec2
- func (v Vec2) Abs() Vec2
- func (v Vec2) Add(v2 Vec2) Vec2
- func (v Vec2) AddS(s float64) Vec2
- func (v Vec2) Angle() float64
- func (v Vec2) Ceil() Vec2
- func (v Vec2) Clamp(min, max Vec2) Vec2
- func (v Vec2) ClampS(min, max float64) Vec2
- func (v Vec2) Cross(v2 Vec2) float64
- func (v Vec2) Distance(v2 Vec2) float64
- func (v Vec2) Div(v2 Vec2) Vec2
- func (v Vec2) DivS(s float64) Vec2
- func (v Vec2) Dot(v2 Vec2) float64
- func (v Vec2) Equal(v2 Vec2) bool
- func (v Vec2) Floor() Vec2
- func (v Vec2) Length() float64
- func (v Vec2) LengthSqr() float64
- func (v Vec2) Lerp(v2 Vec2, t float64) Vec2
- func (v Vec2) Max(v2 Vec2) Vec2
- func (v Vec2) Min(v2 Vec2) Vec2
- func (v Vec2) Mul(v2 Vec2) Vec2
- func (v Vec2) MulS(s float64) Vec2
- func (v Vec2) Normalized() Vec2
- func (v Vec2) Rotate(angle float64) Vec2
- func (v Vec2) Round() Vec2
- func (v Vec2) Sub(v2 Vec2) Vec2
- func (v Vec2) SubS(s float64) Vec2
- type Window
- func (win *Window) Close()
- func (win *Window) GetCursorShape() ebiten.CursorShapeType
- func (win *Window) GetFPS() float64
- func (win *Window) GetMonitorSize() (int, int)
- func (win *Window) GetPosition() (int, int)
- func (win *Window) GetSize() (int, int)
- func (win *Window) GetSizeLimits() (minW, minH, maxW, maxH int)
- func (win *Window) GetTPS() float64
- func (win *Window) GetTitle() string
- func (win *Window) IsCursorCaptured() bool
- func (win *Window) IsCursorVisible() bool
- func (win *Window) IsDecorated() bool
- func (win *Window) IsFloating() bool
- func (win *Window) IsFocused() bool
- func (win *Window) IsFullscreen() bool
- func (win *Window) IsMaximized() bool
- func (win *Window) IsMinimized() bool
- func (win *Window) IsMousePassthrough() bool
- func (win *Window) IsResizable() bool
- func (win *Window) IsRunnableOnUnfocused() bool
- func (win *Window) IsVsync() bool
- func (win *Window) Maximize()
- func (win *Window) Minimize()
- func (win *Window) Restore()
- func (win *Window) SetCursorCaptured(captured bool)
- func (win *Window) SetCursorShape(shape ebiten.CursorShapeType)
- func (win *Window) SetCursorVisible(visible bool)
- func (win *Window) SetDecorated(decorated bool)
- func (win *Window) SetFloating(floating bool)
- func (win *Window) SetFullscreen(fullscreen bool)
- func (win *Window) SetMousePassthrough(passthrough bool)
- func (win *Window) SetPosition(x, y int)
- func (win *Window) SetResizable(resizable bool)
- func (win *Window) SetRunnableOnUnfocused(runnable bool)
- func (win *Window) SetSize(w, h int)
- func (win *Window) SetSizeLimits(minW, minH, maxW, maxH int)
- func (win *Window) SetTPS(tps int)
- func (win *Window) SetTitle(title string)
- func (win *Window) SetVsync(vsync bool)
- type World
- func (w *World) AddQuery(query IQuery)
- func (w *World) Despawn(entity *EntityInstance)
- func (w *World) Entities() []*EntityInstance
- func (w *World) RemoveQuery(query IQuery)
- func (w *World) Spawn(def *EntityDefinition, fn ...func(*EntityInstance))
- func (w *World) SpawnMulti(n int, def *EntityDefinition, fn ...func(*EntityInstance))
Constants ¶
const PIXELS_PER_UNIT float64 = 100
const SCREEN_HEIGHT float64 = 768 / PIXELS_PER_UNIT
const SCREEN_WIDTH float64 = 1024 / PIXELS_PER_UNIT
const WINDOW_HEIGHT int = 768
const WINDOW_WIDTH int = 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetServer ¶
type AssetServer struct {
// contains filtered or unexported fields
}
func NewAssetServer ¶
func NewAssetServer() *AssetServer
func (*AssetServer) Load ¶
func (as *AssetServer) Load(path string) *Handler
func (*AssetServer) LoadAsync ¶
func (as *AssetServer) LoadAsync(path string) *Handler
func (*AssetServer) Unload ¶
func (as *AssetServer) Unload(path string)
type ComponentDefinition ¶
type ComponentDefinition[T any] struct { OnCreated func(*T) OnAttached func(*T, *EntityInstance) OnDetached func(*T, *EntityInstance) // contains filtered or unexported fields }
func NewComponent ¶
func NewComponent[T any]() *ComponentDefinition[T]
func NewComponentWithOptions ¶
func NewComponentWithOptions[T any](options ComponentOptions[T]) *ComponentDefinition[T]
func (*ComponentDefinition[T]) Get ¶
func (c *ComponentDefinition[T]) Get(entity *EntityInstance) *T
func (*ComponentDefinition[T]) Id ¶
func (c *ComponentDefinition[T]) Id() ID
func (*ComponentDefinition[T]) In ¶
func (c *ComponentDefinition[T]) In(entity *EntityInstance) bool
func (*ComponentDefinition[T]) Name ¶
func (c *ComponentDefinition[T]) Name() string
func (*ComponentDefinition[T]) New ¶
func (c *ComponentDefinition[T]) New() any
func (*ComponentDefinition[T]) Type ¶
func (c *ComponentDefinition[T]) Type() reflect.Type
type ComponentOptions ¶
type ComponentOptions[T any] struct { Dependencies []IComponent OnCreated func(*T) OnAttached func(*T, *EntityInstance) OnDetached func(*T, *EntityInstance) }
type Components ¶
type Components []IComponent
type Debug ¶
type Debug struct { Enabled bool // contains filtered or unexported fields }
func (*Debug) BeforeDraw ¶
func (d *Debug) BeforeDraw(fn func(*ebiten.Image))
type EntityDefinition ¶
type EntityDefinition struct { OnSpawned func(*EntityInstance) OnDespawned func(*EntityInstance) // contains filtered or unexported fields }
func NewEntity ¶
func NewEntity(components ...IComponent) *EntityDefinition
func NewEntityWithOptions ¶
func NewEntityWithOptions(options EntityOptions) *EntityDefinition
func (*EntityDefinition) AddComponent ¶
func (e *EntityDefinition) AddComponent(c IComponent) bool
func (*EntityDefinition) Components ¶
func (e *EntityDefinition) Components() []IComponent
func (*EntityDefinition) HasComponent ¶
func (e *EntityDefinition) HasComponent(c IComponent) bool
func (*EntityDefinition) Id ¶
func (e *EntityDefinition) Id() ID
func (*EntityDefinition) New ¶
func (e *EntityDefinition) New() *EntityInstance
func (*EntityDefinition) RemoveComponent ¶
func (e *EntityDefinition) RemoveComponent(c IComponent)
type EntityInstance ¶
type EntityInstance struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------------------- ENTITY INSTANCE -----------------------------------------------------------------------------
func (*EntityInstance) AddComponent ¶
func (e *EntityInstance) AddComponent(c IComponent) bool
func (*EntityInstance) Definition ¶
func (e *EntityInstance) Definition() *EntityDefinition
func (*EntityInstance) GetComponent ¶
func (e *EntityInstance) GetComponent(id ID) any
func (*EntityInstance) HasComponent ¶
func (e *EntityInstance) HasComponent(id ID) bool
func (*EntityInstance) Id ¶
func (e *EntityInstance) Id() ID
func (*EntityInstance) RemoveComponent ¶
func (e *EntityInstance) RemoveComponent(c IComponent)
type EntityOptions ¶
type EntityOptions struct { Components []IComponent OnSpawned func(*EntityInstance) OnDespawned func(*EntityInstance) }
type Game ¶
type Game struct { World *World Assets *AssetServer Renderer *Renderer Inputs *inputs.System Window *Window Screen *Screen Timer *Timer Debug *Debug // contains filtered or unexported fields }
func (*Game) AddService ¶
func (*Game) AddSystem ¶
func (g *Game) AddSystem(system *SystemDefinition, options ...*SystemOptions)
func (*Game) RemoveService ¶
func (*Game) RemoveSystem ¶
func (g *Game) RemoveSystem(system *SystemDefinition)
type IComponent ¶
type QueryDefinition ¶
type QueryDefinition[T any] struct { // contains filtered or unexported fields }
----------------------------------------------------------------------------- QUERY DEFINITION -----------------------------------------------------------------------------
func NewQuery ¶
func NewQuery[T any]() *QueryDefinition[T]
func (*QueryDefinition[T]) Id ¶
func (c *QueryDefinition[T]) Id() ID
func (*QueryDefinition[T]) Name ¶
func (c *QueryDefinition[T]) Name() string
func (*QueryDefinition[T]) Query ¶
func (c *QueryDefinition[T]) Query() []*T
type Rect ¶
func (Rect) Intersects ¶
type RenderLayer ¶
type RenderLayer []*renderItem
func (RenderLayer) Len ¶
func (q RenderLayer) Len() int
func (RenderLayer) Less ¶
func (q RenderLayer) Less(i, j int) bool
func (*RenderLayer) Pop ¶
func (q *RenderLayer) Pop() any
func (*RenderLayer) Push ¶
func (q *RenderLayer) Push(x any)
func (RenderLayer) Swap ¶
func (q RenderLayer) Swap(i, j int)
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func NewRenderer ¶
func NewRenderer() *Renderer
type Screen ¶
type Screen struct { Surface *ebiten.Image PixelsPerUnit float64 // contains filtered or unexported fields }
func (*Screen) GetPosition ¶
func (*Screen) GetRotation ¶
func (*Screen) GetZoomLimits ¶
func (*Screen) ScreenPositionToWorld ¶
func (*Screen) SetPosition ¶
func (*Screen) SetRotation ¶
func (*Screen) SetZoomLimits ¶
func (*Screen) WorldPositionToScreen ¶
type ServiceDefinition ¶
type ServiceDefinition[T any] struct { OnCreated func(*T) // contains filtered or unexported fields }
func NewService ¶
func NewService[T any](default_ ...T) *ServiceDefinition[T]
func (*ServiceDefinition[T]) Get ¶
func (s *ServiceDefinition[T]) Get(g *Game) *T
func (*ServiceDefinition[T]) Id ¶
func (s *ServiceDefinition[T]) Id() ID
func (*ServiceDefinition[T]) In ¶
func (s *ServiceDefinition[T]) In(g *Game) bool
func (*ServiceDefinition[T]) Name ¶
func (s *ServiceDefinition[T]) Name() string
func (*ServiceDefinition[T]) New ¶
func (s *ServiceDefinition[T]) New() any
func (*ServiceDefinition[T]) Type ¶
func (s *ServiceDefinition[T]) Type() reflect.Type
type SystemDefinition ¶
type SystemDefinition struct {
// contains filtered or unexported fields
}
func NewSystem ¶
func NewSystem(fn SystemFn, queries ...IQuery) *SystemDefinition
func (*SystemDefinition) Id ¶
func (s *SystemDefinition) Id() ID
type SystemOptions ¶
type SystemOptions struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------------------- SYSTEM OPTIONS -----------------------------------------------------------------------------
func NewSystemOptions ¶
func NewSystemOptions() *SystemOptions
func (*SystemOptions) Once ¶
func (sb *SystemOptions) Once() *SystemOptions
func (*SystemOptions) Priority ¶
func (sb *SystemOptions) Priority(priority int) *SystemOptions
type Texture ¶
type Texture struct {
Image *ebiten.Image
}
func NewEmptyTexture ¶
func NewTextureFromBytes ¶
func NewTextureFromImage ¶
func NewTextureFromImage(image *ebiten.Image) *Texture
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func (*Window) GetCursorShape ¶
func (win *Window) GetCursorShape() ebiten.CursorShapeType
func (*Window) GetMonitorSize ¶
func (*Window) GetPosition ¶
func (*Window) GetSizeLimits ¶
func (*Window) IsCursorCaptured ¶
func (*Window) IsCursorVisible ¶
func (*Window) IsDecorated ¶
func (*Window) IsFloating ¶
func (*Window) IsFullscreen ¶
func (*Window) IsMaximized ¶
func (*Window) IsMinimized ¶
func (*Window) IsMousePassthrough ¶
func (*Window) IsResizable ¶
func (*Window) IsRunnableOnUnfocused ¶
func (*Window) SetCursorCaptured ¶
func (*Window) SetCursorShape ¶
func (win *Window) SetCursorShape(shape ebiten.CursorShapeType)
func (*Window) SetCursorVisible ¶
func (*Window) SetDecorated ¶
func (*Window) SetFloating ¶
func (*Window) SetFullscreen ¶
func (*Window) SetMousePassthrough ¶
func (*Window) SetPosition ¶
func (*Window) SetResizable ¶
func (*Window) SetRunnableOnUnfocused ¶
func (*Window) SetSizeLimits ¶
type World ¶
type World struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------------------- WORLD -----------------------------------------------------------------------------
func (*World) Despawn ¶
func (w *World) Despawn(entity *EntityInstance)
func (*World) Entities ¶
func (w *World) Entities() []*EntityInstance
func (*World) RemoveQuery ¶
func (*World) Spawn ¶
func (w *World) Spawn(def *EntityDefinition, fn ...func(*EntityInstance))
func (*World) SpawnMulti ¶
func (w *World) SpawnMulti(n int, def *EntityDefinition, fn ...func(*EntityInstance))