try to fix glfw close window
This commit is contained in:
parent
29eb54f7ae
commit
d483570591
44
main.go
44
main.go
@ -26,20 +26,19 @@ type cell struct {
|
|||||||
type slide []*cell
|
type slide []*cell
|
||||||
|
|
||||||
var (
|
var (
|
||||||
x0, y0, selSlide int
|
x0, y0, selSlide int
|
||||||
path string
|
path string
|
||||||
qimg qml.Object
|
qimg qml.Object
|
||||||
textEdit qml.Object
|
textEdit qml.Object
|
||||||
cellQml qml.Object
|
cellQml qml.Object
|
||||||
window *qml.Window
|
window *qml.Window
|
||||||
win *glfw.Window
|
win *glfw.Window
|
||||||
slides slide
|
slides slide
|
||||||
err error
|
err error
|
||||||
monitors []*glfw.Monitor
|
monitors []*glfw.Monitor
|
||||||
projMonitor *glfw.Monitor
|
projMonitor *glfw.Monitor
|
||||||
//mw1 *imagick.MagickWand
|
tex1 uint32
|
||||||
tex1 uint32
|
texDel = false
|
||||||
texDel Bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -49,8 +48,6 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer glfw.Terminate()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
@ -98,7 +95,7 @@ func setupScene() {
|
|||||||
|
|
||||||
gl.ClearColor(0, 0, 0, 0)
|
gl.ClearColor(0, 0, 0, 0)
|
||||||
if texDel {
|
if texDel {
|
||||||
gl.DeleteTextures(1,tex1)
|
gl.DeleteTextures(1, &tex1)
|
||||||
}
|
}
|
||||||
tex1 = newTexture(*slides[selSlide].getImage(x0, y0))
|
tex1 = newTexture(*slides[selSlide].getImage(x0, y0))
|
||||||
|
|
||||||
@ -212,8 +209,9 @@ func glInit() {
|
|||||||
if err := gl.Init(); err != nil {
|
if err := gl.Init(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
setupScene()
|
|
||||||
win.SetPos(projMonitor.GetPos())
|
win.SetPos(projMonitor.GetPos())
|
||||||
|
setupScene()
|
||||||
|
|
||||||
qml.Func1 = func() int {
|
qml.Func1 = func() int {
|
||||||
if !win.ShouldClose() {
|
if !win.ShouldClose() {
|
||||||
@ -224,7 +222,8 @@ func glInit() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
win.Hide()
|
win.Hide()
|
||||||
win.Destroy()
|
//win.Destroy()
|
||||||
|
glfw.Terminate()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -238,7 +237,6 @@ func setSignals() {
|
|||||||
|
|
||||||
window.ObjectByName("btnRem").On("clicked", func() {
|
window.ObjectByName("btnRem").On("clicked", func() {
|
||||||
slides[len(slides)-1].remove()
|
slides[len(slides)-1].remove()
|
||||||
fmt.Println("testing....")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
window.ObjectByName("btnMem").On("clicked", func() {
|
window.ObjectByName("btnMem").On("clicked", func() {
|
||||||
@ -246,7 +244,7 @@ func setSignals() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
window.On("closing", func() {
|
window.On("closing", func() {
|
||||||
win.Hide()
|
win.SetShouldClose(true)
|
||||||
window.Set("cls", true)
|
window.Set("cls", true)
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -293,8 +291,8 @@ func (cl *cell) setSignal() {
|
|||||||
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func() {
|
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func() {
|
||||||
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
|
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
|
||||||
setupScene()
|
setupScene()
|
||||||
}
|
})
|
||||||
|
|
||||||
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
||||||
|
|
||||||
textEdit.Set("cell", cl.index)
|
textEdit.Set("cell", cl.index)
|
||||||
|
Loading…
Reference in New Issue
Block a user