Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define auto-binding #379

Open
nighca opened this issue Nov 8, 2024 · 0 comments
Open

Define auto-binding #379

nighca opened this issue Nov 8, 2024 · 0 comments

Comments

@nighca
Copy link
Collaborator

nighca commented Nov 8, 2024

spx/game.go

Lines 255 to 274 in 845f2c0

for i, n := 0, v.NumField(); i < n; i++ {
name, val := getFieldPtrOrAlloc(g, v, i)
switch fld := val.(type) {
case *Sound:
if g.canBindSound(name) {
media, err := g.loadSound(name)
if err != nil {
panic(err)
}
*fld = media
}
case Sprite:
if g.canBindSprite(name) {
if err := g.loadSprite(fld, name, v); err != nil {
panic(err)
}
}
// p.sprs[name] = fld (has been set by loadSprite)
}
}

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant