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