jl-ecs/component.go

28 lines
634 B
Go

package ecs
import (
"github.com/yohamta/donburi"
"github.com/yohamta/donburi/component"
)
type IComponentType = component.IComponentType
type ComponentType[T any] struct {
*donburi.ComponentType[T]
}
// Get returns component data from the entry.
func (c *ComponentType[T]) Get(entry *Entry) *T {
return c.ComponentType.Get(entry)
}
// Set sets component data to the entry.
func (c *ComponentType[T]) Set(entry *Entry, component *T) {
c.ComponentType.Set(entry, component)
}
// SetValue sets the value of the component.
func (c *ComponentType[T]) SetValue(entry *Entry, value T) {
c.ComponentType.SetValue(entry, value)
}