Skip to content

Commit

Permalink
Add component.GetValue() (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
setanarut authored May 14, 2024
1 parent 0396e89 commit e631a83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions component.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func (c *ComponentType[T]) Get(entry *Entry) *T {
return (*T)(entry.Component(c))
}

// GetValue returns value of the component from the entry.
func (c *ComponentType[T]) GetValue(entry *Entry) T {
return *Get[T](entry, c)
}

// Set sets component data to the entry.
func (c *ComponentType[T]) Set(entry *Entry, component *T) {
entry.SetComponent(c, unsafe.Pointer(component))
Expand Down

0 comments on commit e631a83

Please sign in to comment.