gg/gx/object.go

49 lines
925 B
Go
Raw Normal View History

2023-02-17 12:47:17 +03:00
package gx
// 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.
type Starter interface {
Start(*Engine)
2023-02-17 12:47:17 +03:00
}
// Implementing the interface type
// will call the function on each
// engine iteration.
type Updater interface {
Update(*Engine) 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 {
Delete(*Engine, ...any)
2023-02-17 12:47:17 +03:00
}
type Visibility struct {
Visible bool
}
func (v Visibility) IsVisible() bool {
return v.Visible
}
type Colority struct {
Color Color
}
// The interface describes anything that can be
// drawn. It will be drew corresponding to
// the layers order.
type Drawer interface {
Draw(*Engine, *Image)
GetLayer() Layer
IsVisible() bool
}
// The type represents everything that can work inside engine.
type Object any