2023-10-23 15:45:18 +03:00
|
|
|
package gg
|
2023-02-17 12:47:17 +03:00
|
|
|
|
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-23 00:09:07 +03:00
|
|
|
Update(*Context)
|
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
|
|
|
}
|
|
|
|
|
2024-01-11 07:05:27 +03:00
|
|
|
type Antialiasity struct {
|
|
|
|
Antialias bool
|
|
|
|
}
|
|
|
|
|
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 {
|
2024-01-11 06:39:57 +03:00
|
|
|
Draw(*Context) []EVertex
|
2023-08-31 11:29:37 +03:00
|
|
|
GetLayer() Layer
|
|
|
|
IsVisible() bool
|
|
|
|
}
|
|
|
|
|
2024-01-08 06:09:36 +03:00
|
|
|
type Objecter interface {
|
|
|
|
GetObject() *Object
|
|
|
|
Input() chan *Context
|
|
|
|
Starter
|
|
|
|
Updater
|
2024-01-16 01:08:21 +03:00
|
|
|
Collider
|
|
|
|
Resolver
|
2024-01-08 06:09:36 +03:00
|
|
|
Drawer
|
|
|
|
Deleter
|
|
|
|
}
|
|
|
|
|
|
|
|
// The type for embedding into engine-in types.
|
|
|
|
type Object struct {
|
2024-01-16 01:08:21 +03:00
|
|
|
Collidability
|
|
|
|
Resolvability
|
2024-01-08 06:09:36 +03:00
|
|
|
Layer
|
|
|
|
Visibility
|
2024-01-16 01:08:21 +03:00
|
|
|
|
2024-01-08 06:09:36 +03:00
|
|
|
input chan *Context
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Object) GetObject() *Object { return o }
|
|
|
|
func (o *Object) Input() chan *Context { return o.input }
|
|
|
|
|
|
|
|
func (o *Object) Start(c *Context) {}
|
2024-01-16 01:08:21 +03:00
|
|
|
|
2024-01-08 06:09:36 +03:00
|
|
|
func (o *Object) Update(c *Context) {}
|
2024-01-16 01:08:21 +03:00
|
|
|
|
|
|
|
func (o *Object) ContainedPoints(Points) Points {return Points{}}
|
|
|
|
func (o *Object) Vertices() Vertices {return Vertices{}}
|
|
|
|
func (o *Object) Edges() Edges {return Edges{}}
|
|
|
|
|
|
|
|
func (o *Object) Resolve(c *Context) {}
|
|
|
|
|
2024-01-11 06:39:57 +03:00
|
|
|
func (o *Object) Draw(c *Context) []EVertex { return nil}
|
2024-01-08 06:09:36 +03:00
|
|
|
func (o *Object) Delete(c *Context) {}
|
2023-08-31 11:29:37 +03:00
|
|
|
|