Skip to content

Instantly share code, notes, and snippets.

@Wollw
Created March 19, 2012 18:20
Show Gist options
  • Save Wollw/2122658 to your computer and use it in GitHub Desktop.
Save Wollw/2122658 to your computer and use it in GitHub Desktop.
Simple X11 Window in Go
package main;
import (
"exp/gui"
"exp/gui/x11"
"image"
)
func main() {
w,_ := x11.NewWindow()
ec := w.EventChan()
i := w.Screen()
c := image.RGBAColor{255,255,255,255}
for true {
e := <- ec
switch v := e.(type) {
case gui.MouseEvent:
i.Set(e.(gui.MouseEvent).Loc.X, e.(gui.MouseEvent).Loc.Y, c)
}
w.FlushImage()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment