mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-09 20:47:26 +01:00
Double buffering
This commit is contained in:
parent
b203859eae
commit
5236bb92a4
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user