From d9c9bf88f7ed7c96fa2f43799dbafc2b2c4e4543 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 7 Jan 2019 19:20:11 -0800 Subject: [PATCH] add columns --- platform/imgui/imgui.go | 16 ++++++++++++---- tools/viewer/viewer.go | 11 +++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/platform/imgui/imgui.go b/platform/imgui/imgui.go index d24c61a..a0c4a0c 100644 --- a/platform/imgui/imgui.go +++ b/platform/imgui/imgui.go @@ -16,16 +16,16 @@ func Begin(label string) bool { return bool(C.igBegin(labelC, nil, 0)) } +func End() { + C.igEnd() +} + func Button(label string) bool { labelC := C.CString(label) defer C.free(unsafe.Pointer(labelC)) return bool(C.igButton(labelC, C.ImVec2{})) } -func End() { - C.igEnd() -} - func Image(texture graphics.Texture) { ImageSized(texture, texture.Size()) } @@ -60,3 +60,11 @@ func Text(label string) { defer C.free(unsafe.Pointer(labelStartC)) C.igTextUnformatted(labelStartC, labelEndC) } + +func Columns(count int) { + C.igColumns(C.int(count), nil, true) +} + +func NextColumn() { + C.igNextColumn() +} diff --git a/tools/viewer/viewer.go b/tools/viewer/viewer.go index 0fbc9fc..772eba4 100644 --- a/tools/viewer/viewer.go +++ b/tools/viewer/viewer.go @@ -74,8 +74,15 @@ func (s *scene) Advance() error { } frame := direction.Frames[frameIndex] imgui.SliderInt("Frame", &frameIndex, 0, len(direction.Frames)-1) - imgui.Text(fmt.Sprintf("Size: %+v", frame.Size)) - imgui.Text(fmt.Sprintf("Offset: %+v", frame.Offset)) + imgui.Columns(2) + 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") { platform.WindowSetScene(nil) }