try to fix glfw close window

This commit is contained in:
lordwelch 2016-03-16 10:23:15 -07:00
parent 29eb54f7ae
commit d483570591

42
main.go
View File

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