Double buffering

This commit is contained in:
Hajime Hoshi 2013-06-17 23:51:15 +09:00
parent b203859eae
commit 5236bb92a4

View File

@ -6,11 +6,16 @@ package main
// #include <GLUT/glut.h>
//
// void display(void);
// void idle(void);
//
// static void setDisplayFunc(void) {
// glutDisplayFunc(display);
// }
//
// static void setIdleFunc(void) {
// glutIdleFunc(idle);
// }
//
import "C"
import (
"image/color"
@ -34,6 +39,12 @@ func (game *DemoGame) Draw(g *graphics.GraphicsContext, offscreen *graphics.Text
//export display
func display() {
device.Update()
C.glutSwapBuffers()
}
//export idle
func idle() {
C.glutPostRedisplay()
}
func main() {
@ -62,6 +73,7 @@ func main() {
C.glutCreateWindow(title)
C.setDisplayFunc()
C.setIdleFunc()
game := &DemoGame{}
device = graphics.NewDevice(screenWidth, screenHeight, screenScale,