From 538ad90185a138802511997e8a11b4f873c003dd Mon Sep 17 00:00:00 2001 From: faiface Date: Mon, 27 Mar 2017 00:57:13 +0200 Subject: [PATCH] add code for 01_creating_a_window guide --- examples/guide/01_creating_a_window/main.go | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/guide/01_creating_a_window/main.go diff --git a/examples/guide/01_creating_a_window/main.go b/examples/guide/01_creating_a_window/main.go new file mode 100644 index 0000000..82e5b7c --- /dev/null +++ b/examples/guide/01_creating_a_window/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "github.com/faiface/pixel" + "github.com/faiface/pixel/pixelgl" + "golang.org/x/image/colornames" +) + +func run() { + cfg := pixelgl.WindowConfig{ + Title: "Pixel Rocks!", + Bounds: pixel.R(0, 0, 1024, 768), + VSync: true, + } + win, err := pixelgl.NewWindow(cfg) + if err != nil { + panic(err) + } + + win.Clear(colornames.Skyblue) + + for !win.Closed() { + win.Update() + } +} + +func main() { + pixelgl.Run(run) +}