main.nim
import types
proc newPlayer(x,y: int): Player =
result = new(Player)
result.pos = vec2i(x, y)
types.nim
import nico/vec
type
GameObject* = ref object of RootObj
pos: Vec2i
Player* = ref object of GameObject
dir: int
So, the types are being imported, bit it struggles with the "nested" type imports? If I add the types inside the main file, it works as expected. I have tried to export the Vec2i type in tyes.nim, bit it doesn't help. What am I doing wrong?
Marking the type as exported is not sufficient. You have to mark the field pos as exported (and also for the field dir I guess):
import nico/vec
type
GameObject* = ref object of RootObj
pos*: Vec2i
Player* = ref object of GameObject
dir*: int