-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.go
111 lines (88 loc) · 1.95 KB
/
library.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package component
import (
ray "github.com/gen2brain/raylib-go/raylib"
lua "github.com/yuin/gopher-lua"
)
type Texture struct {
Loaded ray.Texture2D
}
func (Texture) Name() string {
return "texture"
}
type Model struct {
Loaded ray.Model
Scale float32
}
func (Model) Name() string {
return "model"
}
type Position struct {
ray.Vector3
Scale float32
}
func (Position) Name() string {
return "position"
}
type Scriptable struct {
Script *lua.LState
}
func (Scriptable) Name() string {
return "scriptable"
}
// Acceleration describes an entity's rate at which it increases it's velocity.
type Acceleration struct {
ray.Vector3
}
func (Acceleration) Name() string {
return "acceleration"
}
// Colour represents a set of bytes to show colour on a display in an RGB format.
type Colour struct {
Red, Green, Blue byte
}
func (Colour) Name() string {
return "colour"
}
// Dimensions is a representation of the 2D geomtry that makes up an object in
// the game world.
type Dimensions struct {
Width, Height, Radius float32
}
func (Dimensions) Name() string {
return "dimensions"
}
// Gravity represents the amount of gravitational force the entity is under.
type Gravity struct {
Force ray.Vector3
}
func (Gravity) Name() string {
return "gravity"
}
// RigidBody is an entity with a solid body in which deformation is zero or so
// small it can be neglected. The distance between any two given points on a
// rigid body remains constant in time regardless of external forces exerted on
// it.
type RigidBody struct {
Acceleration
Velocity ray.Vector3
}
func (RigidBody) Name() string {
return "rigid_body"
}
// Rotation describes an entity's angle transformation.
type Rotation struct {
X, Y, Z int32
}
func (Rotation) Name() string {
return "rotation"
}
// Transform describes an entity which has a position, rotation, and scale.
type Transform struct {
Position
Rotation
Dimensions
Scale float32
}
func (Transform) Name() string {
return "transform"
}