diff --git a/internal/glfw/glfw/context.go b/internal/glfw/glfw/context.go index 6a03eea81..f4dfa1fa1 100644 --- a/internal/glfw/glfw/context.go +++ b/internal/glfw/glfw/context.go @@ -78,7 +78,7 @@ func SwapInterval(interval int) { func ExtensionSupported(extension string) bool { e := C.CString(extension) defer C.free(unsafe.Pointer(e)) - ret := glfwbool(C.glfwExtensionSupported(e)) + ret := C.glfwExtensionSupported(e) != 0 panicError() return ret } diff --git a/internal/glfw/glfw/input.go b/internal/glfw/glfw/input.go index c1cdc9074..a3b8341d3 100644 --- a/internal/glfw/glfw/input.go +++ b/internal/glfw/glfw/input.go @@ -283,7 +283,7 @@ func goCursorPosCB(window unsafe.Pointer, xpos, ypos C.double) { //export goCursorEnterCB func goCursorEnterCB(window unsafe.Pointer, entered C.int) { w := windows.get((*C.GLFWwindow)(window)) - hasEntered := glfwbool(entered) + hasEntered := entered != 0 w.fCursorEnterHolder(w, hasEntered) } diff --git a/internal/glfw/glfw/util.go b/internal/glfw/glfw/util.go index 344531b6b..8e2822464 100644 --- a/internal/glfw/glfw/util.go +++ b/internal/glfw/glfw/util.go @@ -9,10 +9,6 @@ package glfw // #include import "C" -func glfwbool(b C.int) bool { - return b == C.int(True) -} - func bytes(origin []byte) (pointer *uint8, free func()) { n := len(origin) if n == 0 { diff --git a/internal/glfw/glfw/window.go b/internal/glfw/glfw/window.go index 56c3728f9..006e6adb6 100644 --- a/internal/glfw/glfw/window.go +++ b/internal/glfw/glfw/window.go @@ -270,7 +270,7 @@ func goWindowCloseCB(window unsafe.Pointer) { //export goWindowMaximizeCB func goWindowMaximizeCB(window unsafe.Pointer, maximized C.int) { w := windows.get((*C.GLFWwindow)(window)) - w.fMaximizeHolder(w, glfwbool(maximized)) + w.fMaximizeHolder(w, maximized != 0) } //export goWindowRefreshCB @@ -282,13 +282,13 @@ func goWindowRefreshCB(window unsafe.Pointer) { //export goWindowFocusCB func goWindowFocusCB(window unsafe.Pointer, focused C.int) { w := windows.get((*C.GLFWwindow)(window)) - isFocused := glfwbool(focused) + isFocused := focused != 0 w.fFocusHolder(w, isFocused) } //export goWindowIconifyCB func goWindowIconifyCB(window unsafe.Pointer, iconified C.int) { - isIconified := glfwbool(iconified) + isIconified := iconified != 0 w := windows.get((*C.GLFWwindow)(window)) w.fIconifyHolder(w, isIconified) } @@ -409,7 +409,7 @@ func (w *Window) Destroy() { // ShouldClose reports the value of the close flag of the specified window. func (w *Window) ShouldClose() bool { - ret := glfwbool(C.glfwWindowShouldClose(w.data)) + ret := C.glfwWindowShouldClose(w.data) != 0 panicError() return ret }