Thanks : ) LET'S CONTINUE
import actors
type
ComponentMotion = object
x, y: float
#boilerplate
var storageComponentMotion* = newStorage[ComponentMotion](100)
proc componentMotion*(self: ent): ptr ComponentMotion =
return addr storageComponentMotion.components[self.id]
#is there a way to make code above in template or macro for example like
this?
#I want to hide initialization and make variable like "storage_TypeName_ :
newStorage[_Type_](100)
# Also I want to add a proc method that will return component by id from
the storage above
setupComponent[ComponentMotion]()
var entity: ent = create()
var cMotion = setComponent[ComponentMotion](entity, storageComponentMotion)
cMotion.x = 10
echo cMotion.x
Run