2023-12-20 22:39:33 +03:00
|
|
|
package gg
|
|
|
|
|
2024-06-01 16:07:28 +03:00
|
|
|
// The type is used to provide
|
|
|
|
// custom behaviour for drawing and updating etc.
|
2023-12-20 22:39:33 +03:00
|
|
|
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
|
2023-12-20 22:39:33 +03:00
|
|
|
}
|
2024-05-28 11:24:12 +03:00
|
|
|
|