jl-ecs/component.go

25 lines
564 B
Go

package ecs
import (
"github.com/yohamta/donburi"
)
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.Entry)
}
// Set sets component data to the entry.
func (c *ComponentType[T]) Set(entry *Entry, component *T) {
c.ComponentType.Set(entry.Entry, component)
}
// SetValue sets the value of the component.
func (c *ComponentType[T]) SetValue(entry *Entry, value T) {
c.ComponentType.SetValue(entry.Entry, value)
}