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

Introduce .spx/.gmx as Go+ class files #762

Closed
xushiwei opened this issue Aug 24, 2021 · 2 comments
Closed

Introduce .spx/.gmx as Go+ class files #762

xushiwei opened this issue Aug 24, 2021 · 2 comments

Comments

@xushiwei
Copy link
Member

xushiwei commented Aug 24, 2021

Let's see an example.

Here is content of Foo.gmx:

var (
    Bar Bar
)

func onStart() {
    Bar.clone()
}

Here is content of Bar.spx:

var (
    level int
)

func onStart() {
    level = 1
}
@xushiwei xushiwei added this to the Go+ v1.1 milestone Aug 24, 2021
@xushiwei
Copy link
Member Author

xushiwei commented Aug 24, 2021

import spx "github.com/goplus/spx"

type Foo struct {
    spx.Game
    Bar Bar
}

func (p *Foo) OnStart() {
    p.Bar.Clone()
}

type Bar struct {
    spx.Sprite
    *Foo
    level int
}

func (p *Bar) OnStart() {
    p.level = 1
}

@xushiwei
Copy link
Member Author

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

No branches or pull requests

1 participant