Skip to content

Commit

Permalink
fix some more lin terrors
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Sep 18, 2023
1 parent 669f55f commit 1de7003
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion EventHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions FontAtlasProsessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Keycode.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func keyFromGLFWKey(k imgui.GLFWKey) Key {
}

log.Panicf("Unknown key: %v", k)

return 0
}

Expand Down
14 changes: 7 additions & 7 deletions MasterWindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions Window.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1de7003

Please sign in to comment.