~eliasnaur/gio-example

8edd23762267e850b79658c7a6503c07ae5976a9 — Elias Naur 2 months ago 9861f99
opengl: add pointer input handler

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 7 insertions(+), 0 deletions(-)

M opengl/main.go
M opengl/main.go => opengl/main.go +7 -0
@@ 19,6 19,7 @@ import (

	"gioui.org/app"
	"gioui.org/gpu"
	"gioui.org/io/pointer"
	"gioui.org/io/system"
	"gioui.org/layout"
	"gioui.org/op"


@@ 117,6 118,12 @@ func loop(w *app.Window) error {
			}
			// Build ops.
			gtx := layout.NewContext(&ops, e)
			// Catch pointer events not hitting UI.
			types := pointer.Move | pointer.Press | pointer.Release
			pointer.InputOp{Tag: w, Types: types}.Add(gtx.Ops)
			for _, e := range gtx.Events(w) {
				log.Println("Event:", e)
			}
			drawUI(th, gtx)
			w.Run(func() {
				if ok := C.eglMakeCurrent(ctx.disp, ctx.surf, ctx.surf, ctx.ctx); ok != C.EGL_TRUE {