-
Notifications
You must be signed in to change notification settings - Fork 2
/
events.go
67 lines (49 loc) · 1.54 KB
/
events.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
56
57
58
59
60
61
62
63
64
65
66
67
package gorge
import (
"github.com/stdiopt/gorge/core/event"
)
type gorger interface {
Gorge() *Context
}
func TriggerInMain[T any](g gorger, e T) {
g.Gorge().RunInMain(func() {
event.Trigger(g.Gorge(), e)
})
}
// EventPreUpdate type
type EventPreUpdate float32
// DeltaTime returns the float32 delta time for the event.
func (e EventPreUpdate) DeltaTime() float32 { return float32(e) }
// EventUpdate type
type EventUpdate float32
// DeltaTime returns the float32 delta time for the event.
func (e EventUpdate) DeltaTime() float32 { return float32(e) }
// EventPostUpdate type
type EventPostUpdate float32
// DeltaTime returns the float32 delta time for the event.
func (e EventPostUpdate) DeltaTime() float32 { return float32(e) }
// EventRender happens after pre,update and post update events
type EventRender float32
// EventAddEntity is triggered when entities are added
type EventAddEntity struct {
Entity
}
// EventRemoveEntity is triggered when entities are destroyed
type EventRemoveEntity struct {
Entity
}
// EventStart fired when things starts
type EventStart struct{}
// EventAfterStart to attach stuff (wasm request animation frame workaround)
type EventAfterStart struct{}
// EventDestroy is called when system is shutting down
type EventDestroy struct{}
// EventError contains an error
type EventError struct{ Err error }
// EventWarn contains a warning
type EventWarn string
// EventResourceUpdate sends a resource through systems for aditional treatment
// i.e: uploading to gpu
type EventResourceUpdate struct {
Resource any
}