From ddaddd56cb9254d67ba4f716cdcd3136ff457f48 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Tue, 14 Nov 2023 10:03:25 +0100 Subject: [PATCH 1/6] enable imnodes support --- MasterWindow.go | 4 ++-- Texture.go | 2 +- go.mod | 2 ++ go.sum | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/MasterWindow.go b/MasterWindow.go index 029d5b72..d3fc622e 100644 --- a/MasterWindow.go +++ b/MasterWindow.go @@ -74,7 +74,7 @@ type MasterWindow struct { func NewMasterWindow(title string, width, height int, flags MasterWindowFlags) *MasterWindow { imGuiContext := imgui.CreateContext() imgui.PlotCreateContext() - // imgui.ImNodesCreateContext() // TODO after implementing ImNodes in cimgui + imgui.ImNodesCreateContext() io := imgui.CurrentIO() @@ -207,7 +207,7 @@ func (w *MasterWindow) afterRender() { func (w *MasterWindow) beforeDestroy() { imgui.PlotDestroyContext() - // imgui.ImNodesDestroyContext() // TODO: after adding ImNodes (https://github.com/AllenDang/cimgui-go/issues/137) + imgui.ImNodesDestroyContext() } func (w *MasterWindow) render() { diff --git a/Texture.go b/Texture.go index 955cbd80..7f4c5371 100644 --- a/Texture.go +++ b/Texture.go @@ -43,5 +43,5 @@ func (t *Texture) ID() imgui.TextureID { return t.tex.ID() } - return nil + return imgui.TextureID{} } diff --git a/go.mod b/go.mod index 5ac7ef14..3d2d9804 100644 --- a/go.mod +++ b/go.mod @@ -25,3 +25,5 @@ require ( golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/AllenDang/cimgui-go => github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b diff --git a/go.sum b/go.sum index 38133a2c..f3e2399c 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ -github.com/AllenDang/cimgui-go v0.0.0-20231009021832-f9856eb4a9a7 h1:5+ZimDtDqluBYrfZkbBH8++N2M6z6nFtLT24cdthLsw= -github.com/AllenDang/cimgui-go v0.0.0-20231009021832-f9856eb4a9a7/go.mod h1:UH0IZCbsJKA1hAVQQU6AIDfamqTk0/d3VucaN8lp1Gs= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 h1:dKZMqib/yUDoCFigmz2agG8geZ/e3iRq304/KJXqKyw= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8/go.mod h1:b4uuDd0s6KRIPa84cEEchdQ9ICh7K0OryZHbSzMca9k= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHrj19iqjARrPbaRisD7EuZEVJj6ZMLl1Q= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M= +github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b h1:UXXL8T57rSyuqmBibPlMTESmm/fVEVyBSKKvbHmi4Y4= +github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b/go.mod h1:UH0IZCbsJKA1hAVQQU6AIDfamqTk0/d3VucaN8lp1Gs= github.com/juliettef/IconFontCppHeaders v0.0.0-20230803153112-1a083cca7d65 h1:gOG4RoefWNOMFCISCtv1JSWVw1UUeSTZ0fdm4M0uQ4Q= github.com/juliettef/IconFontCppHeaders v0.0.0-20230803153112-1a083cca7d65/go.mod h1:edkq0hzsRusIHvIaeynCDd0hpwLQbjjHcGnMEuADrVk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= From cd76db9907964cafc24b035d74ae4e3fb7e8dac3 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:49:55 +0100 Subject: [PATCH 2/6] codegen: update --- go.mod | 5 +---- go.sum | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 4798c7be..52f77d83 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,9 @@ module github.com/AllenDang/giu go 1.21 require ( - github.com/AllenDang/cimgui-go v0.0.0-20231009021832-f9856eb4a9a7 + github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 - github.com/juliettef/IconFontCppHeaders v0.0.0-20231102151620-41b304750e83 github.com/mazznoer/csscolorparser v0.1.3 github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 @@ -25,5 +24,3 @@ require ( golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/AllenDang/cimgui-go => github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b diff --git a/go.sum b/go.sum index 674f4a74..a8d6f92d 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHr github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M= github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b h1:UXXL8T57rSyuqmBibPlMTESmm/fVEVyBSKKvbHmi4Y4= github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b/go.mod h1:UH0IZCbsJKA1hAVQQU6AIDfamqTk0/d3VucaN8lp1Gs= -github.com/juliettef/IconFontCppHeaders v0.0.0-20231102151620-41b304750e83 h1:bFKXHT3AtxMZmccjBD88Id9yJHlIspmznB7FeAWTLe0= -github.com/juliettef/IconFontCppHeaders v0.0.0-20231102151620-41b304750e83/go.mod h1:edkq0hzsRusIHvIaeynCDd0hpwLQbjjHcGnMEuADrVk= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mazznoer/csscolorparser v0.1.3 h1:vug4zh6loQxAUxfU1DZEu70gTPufDPspamZlHAkKcxE= From 2e4e42b1c2d46b24b905319f487c6004a6e6bcf3 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:50:59 +0100 Subject: [PATCH 3/6] update go.sum --- go.sum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index a8d6f92d..d14e5915 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ +github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f h1:1QBz18aNcdzN9N8vx2/CoPEcavO43qLjjk0rLekESSg= +github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f/go.mod h1:e6feXR4FrATVY/UrWS3si3KCJOm0wruwbxVI/B85fUM= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 h1:dKZMqib/yUDoCFigmz2agG8geZ/e3iRq304/KJXqKyw= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8/go.mod h1:b4uuDd0s6KRIPa84cEEchdQ9ICh7K0OryZHbSzMca9k= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHrj19iqjARrPbaRisD7EuZEVJj6ZMLl1Q= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M= -github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b h1:UXXL8T57rSyuqmBibPlMTESmm/fVEVyBSKKvbHmi4Y4= -github.com/gucio321/cimgui-go v0.0.0-20231114082315-929315197f3b/go.mod h1:UH0IZCbsJKA1hAVQQU6AIDfamqTk0/d3VucaN8lp1Gs= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mazznoer/csscolorparser v0.1.3 h1:vug4zh6loQxAUxfU1DZEu70gTPufDPspamZlHAkKcxE= From 290c84fdd8e47bfd4a4d409cf8d52fb85b2b6b3b Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:54:45 +0100 Subject: [PATCH 4/6] fonts: fix build error in FontAtlasProsessor.go --- FontAtlasProsessor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FontAtlasProsessor.go b/FontAtlasProsessor.go index 21d5a553..f0e3e2f3 100644 --- a/FontAtlasProsessor.go +++ b/FontAtlasProsessor.go @@ -289,7 +289,7 @@ func (a *FontAtlas) rebuildFontAtlas() { } else { fontConfig.SetFontDataOwnedByAtlas(false) fonts.AddFontFromMemoryTTFV( - unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte)), //nolint:gosec // we need this here + uintptr(unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte))), //nolint:gosec // we need this here int32(len(fontInfo.fontByte)), fontInfo.size, fontConfig, @@ -327,7 +327,7 @@ func (a *FontAtlas) rebuildFontAtlas() { fontConfig := imgui.NewFontConfig() fontConfig.SetFontDataOwnedByAtlas(false) f = fonts.AddFontFromMemoryTTFV( - unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte)), //nolint:gosec // we need this here + uintptr(unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte))), //nolint:gosec // we need this here int32(len(fontInfo.fontByte)), fontInfo.size, fontConfig, From ec30ef39c6140371ddd4b59b61d7c8d01958145a Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:08:43 +0100 Subject: [PATCH 5/6] deps: update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ab67bd9c..de88980f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/AllenDang/giu go 1.21 require ( - github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f + github.com/AllenDang/cimgui-go v0.0.0-20240217115856-389161c9afbe github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 github.com/mazznoer/csscolorparser v0.1.3 diff --git a/go.sum b/go.sum index 14273d5e..bd9dda97 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f h1:1QBz18aNcdzN9N8vx2/CoPEcavO43qLjjk0rLekESSg= -github.com/AllenDang/cimgui-go v0.0.0-20240217094127-20e032baf60f/go.mod h1:e6feXR4FrATVY/UrWS3si3KCJOm0wruwbxVI/B85fUM= +github.com/AllenDang/cimgui-go v0.0.0-20240217115856-389161c9afbe h1:hCgPHyxsipQgkSIDoDkFS6/axFK2tDqXgRySwqdYvZc= +github.com/AllenDang/cimgui-go v0.0.0-20240217115856-389161c9afbe/go.mod h1:e6feXR4FrATVY/UrWS3si3KCJOm0wruwbxVI/B85fUM= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 h1:dKZMqib/yUDoCFigmz2agG8geZ/e3iRq304/KJXqKyw= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8/go.mod h1:b4uuDd0s6KRIPa84cEEchdQ9ICh7K0OryZHbSzMca9k= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= From 1bff32113a70844308b18dba33ae0a038c997b82 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:16:40 +0100 Subject: [PATCH 6/6] examples: fix build error in dragdrop example --- examples/dragdrop/dragdrop.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/dragdrop/dragdrop.go b/examples/dragdrop/dragdrop.go index 40ce4b4b..cc4f056b 100644 --- a/examples/dragdrop/dragdrop.go +++ b/examples/dragdrop/dragdrop.go @@ -19,7 +19,7 @@ func loop() { data := 9 imgui.SetDragDropPayload( "DND_DEMO", - unsafe.Pointer(&data), + uintptr(unsafe.Pointer(&data)), 0, ) g.Label("9").Build() @@ -32,7 +32,7 @@ func loop() { data := 10 imgui.SetDragDropPayload( "DND_DEMO", - unsafe.Pointer(&data), + uintptr(unsafe.Pointer(&data)), 0, ) g.Label("10").Build()