fix mouse wheel scroll, cleanup imgui
This commit is contained in:
parent
6faac2f08e
commit
fa830ec9c8
@ -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)
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user