gg/context.go

36 lines
595 B
Go
Raw Normal View History

package gg
2024-06-01 16:07:28 +03:00
// The type is used to provide
// custom behaviour for drawing and updating etc.
type Context struct {
2024-06-01 16:07:28 +03:00
events Events
engine *Engine
image *Image
}
// Get the current engine.
func (c Context) Engine() *Engine {
return c.engine
}
func (c Context) Camera() Camera {
if c.engine == nil {
return nil
}
return c.engine.camera
}
// Get the image to draw to.
// Can be accessed only in the
// Draw(...) call.
func (c Context) Image() *Image {
return c.image
}
// Get the events.
// Available only in the Update(...) call.
func (c Context) Events() Events {
return c.events
}
2024-05-28 11:24:12 +03:00