Small patch to make working with pointers easier, also a new little example!
Check out CHANGELOG.md and https://pkg.go.dev/github.com/greenthepear/egriden.
Changes:
- Changed signature of
(Gobject).OnDrawFunc
and(Gobject).OnUpdateFunc
functions by adding aself Gobject
parameter. This removes confusing pointer stuff that happens when you want to make aBaseGobject
with custom functions like so:o := NewBaseGobject(...) o.OnDrawFunc = func (i *ebiten.Image, l Layer) { o.NextFrame() //Won't do anything! //Just changes the frame of the original gobject 'template' which will //not be running in the game, since that's what o points to. o.DrawSprite(i, l) } l.AddGobject(o.Build(), 0, 0)
- Also added a
l Layer
parameter to(Gobject).OnUpdateFunc
for convenience. Getting the object's layer pointer into theOnUpdate
function was tricky beforehand.
- Also added a
- Fixed the small issue that
(Gobject).OnUpdate
would never run ever. - Added a new simple example gopher-party to showcase many things added in v0.2.0 and this patch.
- Updated Ebitengine to v2.7.5.
- Updated localization files.