blob: 8c70599a3a44de2a6d40b574d25f0b1f5ed1b5f0 (
plain)
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
|
package coreobjects
import rl "github.com/gen2brain/raylib-go/raylib"
// An object loaded from the package. Impmiments GameObject interface
type DynamicObject struct {
Position rl.Vector2
Textures []*TextureBlock
}
// The dynamic objects can contain multiple textures. This struct
// represents one of those parts
type TextureBlock struct {
Texture *rl.Texture2D
Offset rl.Vector2
}
func (base *DynamicObject) Create(SceneManager) {
}
func (base *DynamicObject) Destroy() {
}
func (base *DynamicObject) Update() {
}
func (base *DynamicObject) Draw() {
for _, v := range base.Textures {
rl.DrawTexture(*v.Texture,
int32(base.Position.X + v.Offset.X),
int32(base.Position.Y + v.Offset.Y),
rl.White)
}
}
func (base *DynamicObject) Clone() *DynamicObject {
var outp = DynamicObject {
Position: base.Position,
Textures: base.Textures,
}
return &outp
}
|