add columns

This commit is contained in:
Alex Yatskov 2019-01-07 19:20:11 -08:00
parent fa830ec9c8
commit d9c9bf88f7
2 changed files with 21 additions and 6 deletions

View File

@ -16,16 +16,16 @@ func Begin(label string) bool {
return bool(C.igBegin(labelC, nil, 0)) return bool(C.igBegin(labelC, nil, 0))
} }
func End() {
C.igEnd()
}
func Button(label string) bool { func Button(label string) bool {
labelC := C.CString(label) labelC := C.CString(label)
defer C.free(unsafe.Pointer(labelC)) defer C.free(unsafe.Pointer(labelC))
return bool(C.igButton(labelC, C.ImVec2{})) return bool(C.igButton(labelC, C.ImVec2{}))
} }
func End() {
C.igEnd()
}
func Image(texture graphics.Texture) { func Image(texture graphics.Texture) {
ImageSized(texture, texture.Size()) ImageSized(texture, texture.Size())
} }
@ -60,3 +60,11 @@ func Text(label string) {
defer C.free(unsafe.Pointer(labelStartC)) defer C.free(unsafe.Pointer(labelStartC))
C.igTextUnformatted(labelStartC, labelEndC) C.igTextUnformatted(labelStartC, labelEndC)
} }
func Columns(count int) {
C.igColumns(C.int(count), nil, true)
}
func NextColumn() {
C.igNextColumn()
}

View File

@ -74,8 +74,15 @@ func (s *scene) Advance() error {
} }
frame := direction.Frames[frameIndex] frame := direction.Frames[frameIndex]
imgui.SliderInt("Frame", &frameIndex, 0, len(direction.Frames)-1) imgui.SliderInt("Frame", &frameIndex, 0, len(direction.Frames)-1)
imgui.Text(fmt.Sprintf("Size: %+v", frame.Size)) imgui.Columns(2)
imgui.Text(fmt.Sprintf("Offset: %+v", frame.Offset)) imgui.Text("Size")
imgui.NextColumn()
imgui.Text(fmt.Sprintf("%+v", frame.Size))
imgui.NextColumn()
imgui.Text("Offset")
imgui.NextColumn()
imgui.Text(fmt.Sprintf("%+v", frame.Offset))
imgui.Columns(1)
if imgui.Button("Exit") { if imgui.Button("Exit") {
platform.WindowSetScene(nil) platform.WindowSetScene(nil)
} }