-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsts.go
50 lines (37 loc) · 1.01 KB
/
consts.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
package gecs
import (
"strconv"
)
// EntityID entity runtime id
type EntityID uint32
// DefaultPlaceholder default entity id
const DefaultPlaceholder EntityID = entityMask
func (e EntityID) toInt() int {
return int(e)
}
func (e EntityID) String() string {
if DefaultPlaceholder == e {
return "^"
}
return strconv.FormatUint(uint64(e), 10)
}
// ComponentID component runtime id
type ComponentID uint32
// SingletonID singleton runtime id
type SingletonID uint32
// _EnttPageSize must be a power of two
const _EnttPageSize int = 1 << 15
// 4 because of entityID is uint32 which is place 4 bytes
const _EnttPerPage int = _EnttPageSize / 4
// EntityID for uint32 entityid
type _VersionType uint16
type _DifferenceType int64
const entityMask = 0xFFFFF // 20bits for entity number
const versionMask = 0xFFF // 12bits for the version(reset in (0-4095))
const entityShift = 20 // 20bits for entity number
type _KVComIDInt map[ComponentID]int
type _KVStrInt map[string]int
type _Vars struct {
id int
data interface{}
}