From f6c374dfc77b705561d061756cfcb76c8fbe728b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pietka?= Date: Thu, 15 Dec 2016 18:19:08 +0100 Subject: [PATCH] Colorize golang example in README --- README.md | 68 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index c9329ef..6fe4940 100644 --- a/README.md +++ b/README.md @@ -36,42 +36,44 @@ For more information, please refer to ## Example - package main - - import ( - "github.com/vbsw/glut" - ) - - func main() { - glut.Init() - glut.InitDisplayMode(glut.SINGLE | glut.RGBA) - glut.InitWindowSize(640, 480) - glut.CreateWindow("Testing GLUT binding for Go"); - glut.ReshapeFunc(reshape) - glut.DisplayFunc(display) - glut.KeyboardFunc(keyboard) - glut.MainLoop() - } - - func reshape(width, height int) { - println("reshape") - } - - func display() { - println("display") - } - - func keyboard(key uint8, x, y int) { - if key==27 { // escape - glut.DestroyWindow(glut.GetWindow()) +```golang +package main + +import ( + "github.com/vbsw/glut" +) + +func main() { + glut.Init() + glut.InitDisplayMode(glut.SINGLE | glut.RGBA) + glut.InitWindowSize(640, 480) + glut.CreateWindow("Testing GLUT binding for Go"); + glut.ReshapeFunc(reshape) + glut.DisplayFunc(display) + glut.KeyboardFunc(keyboard) + glut.MainLoop() +} + +func reshape(width, height int) { + println("reshape") +} + +func display() { + println("display") +} + +func keyboard(key uint8, x, y int) { + if key==27 { // escape + glut.DestroyWindow(glut.GetWindow()) + } else { + if (glut.GetModifiers() & glut.ACTIVE_CTRL) > 0 { + println("key pressed: ctrl +", key) } else { - if (glut.GetModifiers() & glut.ACTIVE_CTRL) > 0 { - println("key pressed: ctrl +", key) - } else { - println("key pressed:", key) - } + println("key pressed:", key) } } +} +``` ## Installation