refactor ImGUI code files
This commit is contained in:
26
internal/igwrap/convert.go
Normal file
26
internal/igwrap/convert.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package igwrap
|
||||
|
||||
import (
|
||||
"edgaru089.ml/go/gl01/internal/util/itype"
|
||||
"github.com/inkyblackness/imgui-go/v4"
|
||||
)
|
||||
|
||||
// Color converts non-premultiplied RGBA color into imgui.Vec4.
|
||||
func Color(r, g, b, a uint8) imgui.Vec4 {
|
||||
return imgui.Vec4{
|
||||
X: float32(r) / 255,
|
||||
Y: float32(g) / 255,
|
||||
Z: float32(b) / 255,
|
||||
W: float32(a) / 255,
|
||||
}
|
||||
}
|
||||
|
||||
// Vec2 converts itype.Vec2f to imgui.Vec2.
|
||||
func Vec2(v itype.Vec2f) imgui.Vec2 {
|
||||
return imgui.Vec2{X: v[0], Y: v[1]}
|
||||
}
|
||||
|
||||
// Vec4 converts itype.Vec4f to imgui.Vec4.
|
||||
func Vec4(v itype.Vec4f) imgui.Vec4 {
|
||||
return imgui.Vec4{X: v[0], Y: v[1], Z: v[2], W: v[3]}
|
||||
}
|
||||
Reference in New Issue
Block a user