forked from inkyblackness/imgui-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vectors.go
54 lines (49 loc) · 1011 Bytes
/
Vectors.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
package imgui
// #include "imguiWrapperTypes.h"
import "C"
// Vec2 represents a two-dimensional vector.
type Vec2 struct {
X float32
Y float32
}
func (vec *Vec2) wrapped() (out *C.IggVec2, finisher func()) {
if vec != nil {
out = &C.IggVec2{
x: C.float(vec.X),
y: C.float(vec.Y),
}
finisher = func() {
vec.X = float32(out.x) // nolint: gotype
vec.Y = float32(out.y) // nolint: gotype
}
} else {
finisher = func() {}
}
return
}
// Vec4 represents a four-dimensional vector.
type Vec4 struct {
X float32
Y float32
Z float32
W float32
}
func (vec *Vec4) wrapped() (out *C.IggVec4, finisher func()) {
if vec != nil {
out = &C.IggVec4{
x: C.float(vec.X),
y: C.float(vec.Y),
z: C.float(vec.Z),
w: C.float(vec.W),
}
finisher = func() {
vec.X = float32(out.x) // nolint: gotype
vec.Y = float32(out.y) // nolint: gotype
vec.Z = float32(out.z) // nolint: gotype
vec.W = float32(out.w) // nolint: gotype
}
} else {
finisher = func() {}
}
return
}