From 1de700341850dfb79955f824b478eda8e6449dd5 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:40:19 +0200 Subject: [PATCH] fix some more lin terrors --- EventHandler.go | 2 +- FontAtlasProsessor.go | 4 ++-- Keycode.go | 1 + MasterWindow.go | 14 +++++++------- Window.go | 1 + 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/EventHandler.go b/EventHandler.go index 49eb7834..2524c8bf 100644 --- a/EventHandler.go +++ b/EventHandler.go @@ -116,7 +116,7 @@ func (eh *EventHandler) OnMouseReleased(mouseButton MouseButton, callback func() // Build implements Widget interface // -//nolint:gocognit,gocyclo // will fix later +// nolint:,gocyclo // will fix later func (eh *EventHandler) Build() { isActive := IsItemActive() diff --git a/FontAtlasProsessor.go b/FontAtlasProsessor.go index 02d3df9f..21d5a553 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)), + 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)), + unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte)), //nolint:gosec // we need this here int32(len(fontInfo.fontByte)), fontInfo.size, fontConfig, diff --git a/Keycode.go b/Keycode.go index 4f292cf4..038c81f1 100644 --- a/Keycode.go +++ b/Keycode.go @@ -202,6 +202,7 @@ func keyFromGLFWKey(k imgui.GLFWKey) Key { } log.Panicf("Unknown key: %v", k) + return 0 } diff --git a/MasterWindow.go b/MasterWindow.go index bc2342f1..b5658273 100644 --- a/MasterWindow.go +++ b/MasterWindow.go @@ -92,7 +92,7 @@ func NewMasterWindow(title string, width, height int, flags MasterWindowFlags) * Context = CreateContext(backend) mw := &MasterWindow{ - clearColor: imgui.Vec4{0, 0, 0, 1}, + clearColor: imgui.Vec4{X: 0, Y: 0, Z: 0, W: 1}, width: width, height: height, title: title, @@ -208,7 +208,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() // TODO: after adding ImNodes (https://github.com/AllenDang/cimgui-go/issues/137) } func (w *MasterWindow) render() { @@ -264,17 +264,17 @@ func (w *MasterWindow) SetBgColor(bgColor color.Color) { r, g, b, a := bgColor.RGBA() w.clearColor = imgui.Vec4{ - float32(r) / mask, - float32(g) / mask, - float32(b) / mask, - float32(a) / mask, + X: float32(r) / mask, + Y: float32(g) / mask, + Z: float32(b) / mask, + W: float32(a) / mask, } w.backend.SetBgColor(w.clearColor) } // GetPos return position of master window. -func (w *MasterWindow) GetPos() (x int, y int) { +func (w *MasterWindow) GetPos() (x, y int) { var xResult, yResult int32 if w.backend != nil { xResult, yResult = w.backend.GetWindowPos() diff --git a/Window.go b/Window.go index 16d551e3..50f20980 100644 --- a/Window.go +++ b/Window.go @@ -71,6 +71,7 @@ type WindowWidget struct { // Window creates a WindowWidget. func Window(title string) *WindowWidget { defaultPos := imgui.MainViewport().Pos() + return (&WindowWidget{ title: title, }).Pos(defaultPos.X, defaultPos.Y)