From 71ca49b9f6dfd44b68fb5e71fc2439783e98bfe6 Mon Sep 17 00:00:00 2001 From: Konstantin8105 Date: Wed, 20 Apr 2022 20:44:31 +0300 Subject: [PATCH 1/3] Combo: example --- internal/demo/Window.go | 7 +++++++ internal/platforms/glfw.go | 1 + internal/platforms/sdl.go | 1 + 3 files changed, 9 insertions(+) diff --git a/internal/demo/Window.go b/internal/demo/Window.go index 2a31362..693ac79 100644 --- a/internal/demo/Window.go +++ b/internal/demo/Window.go @@ -224,6 +224,13 @@ func (widgets *widgets) show() { widgets.radio = 2 } + var c int + imgui.Combo("combo", &c, []string{ + "first", + "second", + "car", + }, 0) + imgui.TreePop() } } diff --git a/internal/platforms/glfw.go b/internal/platforms/glfw.go index d8a0d2c..c99909d 100644 --- a/internal/platforms/glfw.go +++ b/internal/platforms/glfw.go @@ -130,6 +130,7 @@ func (platform *GLFW) NewFrame() { // PostRender performs a buffer swap. func (platform *GLFW) PostRender() { platform.window.SwapBuffers() + imgui.UpdatePointers() } func (platform *GLFW) setKeyMapping() { diff --git a/internal/platforms/sdl.go b/internal/platforms/sdl.go index a27960e..d7cb865 100644 --- a/internal/platforms/sdl.go +++ b/internal/platforms/sdl.go @@ -147,6 +147,7 @@ func (platform *SDL) NewFrame() { // PostRender performs a buffer swap. func (platform *SDL) PostRender() { platform.window.GLSwap() + imgui.UpdatePointers() } func (platform *SDL) setKeyMapping() { From 72692f195d21f0bb959a74476be32465cb3005f1 Mon Sep 17 00:00:00 2001 From: Konstantin8105 Date: Wed, 20 Apr 2022 21:38:43 +0300 Subject: [PATCH 2/3] Combo: example --- internal/demo/Window.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/demo/Window.go b/internal/demo/Window.go index 693ac79..1605700 100644 --- a/internal/demo/Window.go +++ b/internal/demo/Window.go @@ -224,12 +224,11 @@ func (widgets *widgets) show() { widgets.radio = 2 } - var c int - imgui.Combo("combo", &c, []string{ - "first", - "second", - "car", - }, 0) + imgui.Combo("combo", &widgets.radio, []string{ + "one item", + "two items", + "three items", + }) imgui.TreePop() } From 5c3686568496319339c7b06d9101ce9025d1f1da Mon Sep 17 00:00:00 2001 From: Konstantin8105 Date: Wed, 20 Apr 2022 22:03:33 +0300 Subject: [PATCH 3/3] minimaze --- internal/demo/Window.go | 2 +- internal/platforms/glfw.go | 1 - internal/platforms/sdl.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/demo/Window.go b/internal/demo/Window.go index 1605700..94890f4 100644 --- a/internal/demo/Window.go +++ b/internal/demo/Window.go @@ -192,7 +192,7 @@ func showUserGuide() { type widgets struct { buttonClicked int check bool - radio int + radio int32 } // nolint: nestif diff --git a/internal/platforms/glfw.go b/internal/platforms/glfw.go index c99909d..d8a0d2c 100644 --- a/internal/platforms/glfw.go +++ b/internal/platforms/glfw.go @@ -130,7 +130,6 @@ func (platform *GLFW) NewFrame() { // PostRender performs a buffer swap. func (platform *GLFW) PostRender() { platform.window.SwapBuffers() - imgui.UpdatePointers() } func (platform *GLFW) setKeyMapping() { diff --git a/internal/platforms/sdl.go b/internal/platforms/sdl.go index d7cb865..a27960e 100644 --- a/internal/platforms/sdl.go +++ b/internal/platforms/sdl.go @@ -147,7 +147,6 @@ func (platform *SDL) NewFrame() { // PostRender performs a buffer swap. func (platform *SDL) PostRender() { platform.window.GLSwap() - imgui.UpdatePointers() } func (platform *SDL) setKeyMapping() {