diff --git a/backend/backend.go b/backend/backend.go index 329bdb2ac..dee9a4922 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -118,7 +118,7 @@ type ( SizeChangeCallback func(w, h int) ) -type WindowCloseCallback[BackendFlagsT ~int] func(b Backend[BackendFlagsT]) +type WindowCloseCallback func() //export closeCallback func closeCallback(wnd unsafe.Pointer) { @@ -161,7 +161,7 @@ type Backend[BackendFlagsT ~int] interface { SetTargetFPS(fps uint) SetDropCallback(DropCallback) - SetCloseCallback(WindowCloseCallback[BackendFlagsT]) + SetCloseCallback(WindowCloseCallback) SetKeyCallback(KeyCallback) SetSizeChangeCallback(SizeChangeCallback) // SetWindowFlags selected hint to specified value. diff --git a/backend/ebiten-backend/cimgui_backend_impl.go b/backend/ebiten-backend/cimgui_backend_impl.go index 5dd435b0a..c78047af8 100644 --- a/backend/ebiten-backend/cimgui_backend_impl.go +++ b/backend/ebiten-backend/cimgui_backend_impl.go @@ -114,7 +114,7 @@ func (b *EbitenBackend) SetDropCallback(backend.DropCallback) { panic("SetDropCallback is not implemented for Ebiten backend yet.") } -func (b *EbitenBackend) SetCloseCallback(cb backend.WindowCloseCallback[EbitenBackendFlags]) { +func (b *EbitenBackend) SetCloseCallback(cb backend.WindowCloseCallback) { b.closeCb = cb } diff --git a/backend/ebiten-backend/ebiten_backend.go b/backend/ebiten-backend/ebiten_backend.go index c010448f4..d0cf96137 100644 --- a/backend/ebiten-backend/ebiten_backend.go +++ b/backend/ebiten-backend/ebiten_backend.go @@ -29,7 +29,7 @@ type EbitenBackend struct { afterRender, beforeDestroy, loop func() - closeCb backend.WindowCloseCallback[EbitenBackendFlags] + closeCb backend.WindowCloseCallback // ebiten stuff filter ebiten.Filter @@ -112,7 +112,7 @@ func (e *EbitenBackend) SetContext(ctx *imgui.Context) *EbitenBackend { // This is usually called inside the game's Update() function. func (e *EbitenBackend) BeginFrame() { if ebiten.IsWindowBeingClosed() && e.closeCb != nil { - e.closeCb(e) + e.closeCb() } if e.beforeRender != nil { diff --git a/backend/glfwbackend/glfw_backend.go b/backend/glfwbackend/glfw_backend.go index 678bc747f..01f541031 100644 --- a/backend/glfwbackend/glfw_backend.go +++ b/backend/glfwbackend/glfw_backend.go @@ -382,9 +382,9 @@ func (b *GLFWBackend) SetDropCallback(cbfun backend.DropCallback) { C.igGLFWWindow_SetDropCallbackCB(b.handle()) } -func (b *GLFWBackend) SetCloseCallback(cbfun backend.WindowCloseCallback[GLFWWindowFlags]) { +func (b *GLFWBackend) SetCloseCallback(cbfun backend.WindowCloseCallback) { b.closeCB = func(_ unsafe.Pointer) { - cbfun(b) + cbfun() } C.igGLFWWindow_SetCloseCallback(b.handle()) diff --git a/backend/sdlbackend/sdl_backend.go b/backend/sdlbackend/sdl_backend.go index 0f61f134f..35ca5b015 100644 --- a/backend/sdlbackend/sdl_backend.go +++ b/backend/sdlbackend/sdl_backend.go @@ -414,9 +414,9 @@ func (b *SDLBackend) SetDropCallback(cbfun backend.DropCallback) { // C.igSDLWindow_SetDropCallbackCB(b.handle()) } -func (b *SDLBackend) SetCloseCallback(cbfun backend.WindowCloseCallback[SDLWindowFlags]) { +func (b *SDLBackend) SetCloseCallback(cbfun backend.WindowCloseCallback) { b.closeCB = func(_ unsafe.Pointer) { - cbfun(b) + cbfun() } // TODO: not implemented diff --git a/examples/ebiten-game-in-texture/main.go b/examples/ebiten-game-in-texture/main.go index 290c42e6e..9c8301f2d 100644 --- a/examples/ebiten-game-in-texture/main.go +++ b/examples/ebiten-game-in-texture/main.go @@ -69,7 +69,7 @@ func main() { }) */ - currentBackend.SetCloseCallback(func(b backend.Backend[ebitenbackend.EbitenBackendFlags]) { + currentBackend.SetCloseCallback(func() { fmt.Println("window is closing") }) diff --git a/examples/ebiten/main.go b/examples/ebiten/main.go index 9b6f2f14e..e81141967 100644 --- a/examples/ebiten/main.go +++ b/examples/ebiten/main.go @@ -29,7 +29,7 @@ func main() { }) */ - currentBackend.SetCloseCallback(func(b backend.Backend[ebitenbackend.EbitenBackendFlags]) { + currentBackend.SetCloseCallback(func() { fmt.Println("window is closing") }) diff --git a/examples/glfw/main.go b/examples/glfw/main.go index befbcd320..0fb79a38c 100644 --- a/examples/glfw/main.go +++ b/examples/glfw/main.go @@ -32,7 +32,7 @@ func main() { fmt.Printf("drop triggered: %v", p) }) - currentBackend.SetCloseCallback(func(b backend.Backend[glfwbackend.GLFWWindowFlags]) { + currentBackend.SetCloseCallback(func() { fmt.Println("window is closing") }) diff --git a/examples/sdl/main.go b/examples/sdl/main.go index 62110a1c0..734442821 100644 --- a/examples/sdl/main.go +++ b/examples/sdl/main.go @@ -31,7 +31,7 @@ func main() { fmt.Printf("drop triggered: %v", p) }) - currentBackend.SetCloseCallback(func(b backend.Backend[sdlbackend.SDLWindowFlags]) { + currentBackend.SetCloseCallback(func() { fmt.Println("window is closing") })