2023-10-23 15:45:18 +03:00
|
|
|
package gg
|
2023-02-17 12:47:17 +03:00
|
|
|
|
2023-12-20 22:39:33 +03:00
|
|
|
// Implementing the interface lets the object
|
|
|
|
// to handle emited events.
|
|
|
|
type Eventer interface {
|
|
|
|
Event(*Context)
|
|
|
|
}
|
|
|
|
|
2023-05-04 19:31:33 +03:00
|
|
|
// Implementing the interface type
|
|
|
|
// will call the function OnStart
|
|
|
|
// when first appear on scene BEFORE
|
|
|
|
// the OnUpdate.
|
2023-05-26 18:31:04 +03:00
|
|
|
// The v value will be get from Add function.
|
2023-05-04 19:31:33 +03:00
|
|
|
type Starter interface {
|
2023-12-20 22:39:33 +03:00
|
|
|
Start(*Context)
|
2023-02-17 12:47:17 +03:00
|
|
|
}
|
|
|
|
|
2023-05-04 19:31:33 +03:00
|
|
|
// Implementing the interface type
|
|
|
|
// will call the function on each
|
|
|
|
// engine iteration.
|
|
|
|
type Updater interface {
|
2023-12-20 22:39:33 +03:00
|
|
|
Update(*Context) error
|
2023-02-17 12:47:17 +03:00
|
|
|
}
|
|
|
|
|
2023-05-26 18:31:04 +03:00
|
|
|
// Implementing the interface type
|
|
|
|
// will call the function on deleting
|
|
|
|
// the object.
|
|
|
|
type Deleter interface {
|
2023-12-20 22:39:33 +03:00
|
|
|
Delete(*Context)
|
2023-02-17 12:47:17 +03:00
|
|
|
}
|
|
|
|
|
2023-12-20 22:39:33 +03:00
|
|
|
// Feat to embed for turning visibility on and off.
|
2023-08-31 11:29:37 +03:00
|
|
|
type Visibility struct {
|
|
|
|
Visible bool
|
|
|
|
}
|
|
|
|
func (v Visibility) IsVisible() bool {
|
|
|
|
return v.Visible
|
|
|
|
}
|
|
|
|
|
2023-12-20 22:39:33 +03:00
|
|
|
// Feat to embed to make colorful objects.
|
2023-08-31 11:29:37 +03:00
|
|
|
type Colority struct {
|
|
|
|
Color Color
|
|
|
|
}
|
|
|
|
|
|
|
|
// The interface describes anything that can be
|
|
|
|
// drawn. It will be drew corresponding to
|
2023-12-20 22:39:33 +03:00
|
|
|
// the layers order so the layer must be returned.
|
2023-08-31 11:29:37 +03:00
|
|
|
type Drawer interface {
|
2023-12-20 22:39:33 +03:00
|
|
|
Draw(*Context)
|
2023-08-31 11:29:37 +03:00
|
|
|
GetLayer() Layer
|
|
|
|
IsVisible() bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// The type represents everything that can work inside engine.
|
|
|
|
type Object any
|
|
|
|
|