forked from surdeus/gox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.go
56 lines (47 loc) · 1.12 KB
/
object.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package gg
// Implementing the interface lets the object
// to handle emited events.
type Eventer interface {
Event(*Context)
}
// Implementing the interface type
// will call the function OnStart
// when first appear on scene BEFORE
// the OnUpdate.
// The v value will be get from Add function.
type Starter interface {
Start(*Context)
}
// Implementing the interface type
// will call the function on each
// engine iteration.
type Updater interface {
Update(*Context)
}
// Implementing the interface type
// will call the function on deleting
// the object.
type Deleter interface {
Delete(*Context)
}
// Feat to embed for turning visibility on and off.
type Visibility struct {
Visible bool
}
func (v Visibility) IsVisible() bool {
return v.Visible
}
// Feat to embed to make colorful objects.
type Colority struct {
Color Color
}
// The interface describes anything that can be
// drawn. It will be drew corresponding to
// the layers order so the layer must be returned.
type Drawer interface {
Draw(*Context)
GetLayer() Layer
IsVisible() bool
}
// The type represents everything that can work inside engine.
type Object any