From 29eb54f7ae55a8df47364d5ee8cb9b91ebc9dc22 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Tue, 15 Mar 2016 11:02:58 -0700 Subject: [PATCH] start making the projected image change --- main.go | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 413917b..9e200ee 100644 --- a/main.go +++ b/main.go @@ -26,19 +26,20 @@ type cell struct { type slide []*cell var ( - x0, y0 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 + 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 + tex1 uint32 + texDel Bool ) func main() { @@ -96,14 +97,17 @@ func run() error { func setupScene() { gl.ClearColor(0, 0, 0, 0) - - tex1 = newTexture(*slides[0].getImage(x0, y0)) + if texDel { + gl.DeleteTextures(1,tex1) + } + tex1 = newTexture(*slides[selSlide].getImage(x0, y0)) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() gl.Ortho(-1, 1, -1, 1, 1.0, 10.0) gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() + texDel = true } @@ -286,6 +290,11 @@ func (cl cell) getImage(x, y int) (img *image.RGBA) { } 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() { textEdit.Set("cell", cl.index)