diff --git a/platform/imgui/context.go b/platform/imgui/context.go index 4eba0f7..feffc1a 100644 --- a/platform/imgui/context.go +++ b/platform/imgui/context.go @@ -152,16 +152,8 @@ func ProcessEvent(event sdl.Event) (bool, error) { switch event.GetType() { case sdl.MOUSEWHEEL: wheelEvent := event.(*sdl.MouseWheelEvent) - if wheelEvent.X > 0 { - imguiState.imguiIo.MouseDelta.x++ - } else if wheelEvent.X < 0 { - imguiState.imguiIo.MouseDelta.x-- - } - if wheelEvent.Y > 0 { - imguiState.imguiIo.MouseDelta.y++ - } else if wheelEvent.Y < 0 { - imguiState.imguiIo.MouseDelta.y-- - } + imguiState.imguiIo.MouseWheelH += C.float(wheelEvent.X) + imguiState.imguiIo.MouseWheel += C.float(wheelEvent.Y) return true, nil case sdl.MOUSEBUTTONDOWN: buttonEvent := event.(*sdl.MouseButtonEvent) diff --git a/platform/imgui/imgui.go b/platform/imgui/imgui.go index dd8c5e7..d24c61a 100644 --- a/platform/imgui/imgui.go +++ b/platform/imgui/imgui.go @@ -10,22 +10,22 @@ import ( "github.com/FooSoft/lazarus/math" ) -func DialogBegin(label string) bool { +func Begin(label string) bool { labelC := C.CString(label) defer C.free(unsafe.Pointer(labelC)) return bool(C.igBegin(labelC, nil, 0)) } -func DialogEnd() { - 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()) } @@ -41,6 +41,10 @@ func ImageSized(texture graphics.Texture, size math.Vec2i) { ) } +func SameLine() { + C.igSameLine(0, -1) +} + func SliderInt(label string, value *int, min, max int) bool { labelC := C.CString(label) defer C.free(unsafe.Pointer(labelC)) diff --git a/tools/viewer/viewer.go b/tools/viewer/viewer.go index 64d59ed..0fbc9fc 100644 --- a/tools/viewer/viewer.go +++ b/tools/viewer/viewer.go @@ -66,7 +66,7 @@ func (s *scene) Advance() error { } } - imgui.DialogBegin("DC6 Viewer") + imgui.Begin("DC6 Viewer") imgui.Image(s.texture) direction := s.animation.Directions[directionIndex] if imgui.SliderInt("Direction", &directionIndex, 0, len(s.animation.Directions)-1) { @@ -79,7 +79,7 @@ func (s *scene) Advance() error { if imgui.Button("Exit") { platform.WindowSetScene(nil) } - imgui.DialogEnd() + imgui.End() if directionIndex != s.directionIndex || frameIndex != s.frameIndex { s.directionIndex = directionIndex