gg/context.go
2024-06-01 18:07:28 +05:00

35 lines
595 B
Go

package gg
// The type is used to provide
// custom behaviour for drawing and updating etc.
type Context struct {
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
}