mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
Double buffering
This commit is contained in:
parent
b203859eae
commit
5236bb92a4
@ -6,11 +6,16 @@ package main
|
|||||||
// #include <GLUT/glut.h>
|
// #include <GLUT/glut.h>
|
||||||
//
|
//
|
||||||
// void display(void);
|
// void display(void);
|
||||||
|
// void idle(void);
|
||||||
//
|
//
|
||||||
// static void setDisplayFunc(void) {
|
// static void setDisplayFunc(void) {
|
||||||
// glutDisplayFunc(display);
|
// glutDisplayFunc(display);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// static void setIdleFunc(void) {
|
||||||
|
// glutIdleFunc(idle);
|
||||||
|
// }
|
||||||
|
//
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@ -34,6 +39,12 @@ func (game *DemoGame) Draw(g *graphics.GraphicsContext, offscreen *graphics.Text
|
|||||||
//export display
|
//export display
|
||||||
func display() {
|
func display() {
|
||||||
device.Update()
|
device.Update()
|
||||||
|
C.glutSwapBuffers()
|
||||||
|
}
|
||||||
|
|
||||||
|
//export idle
|
||||||
|
func idle() {
|
||||||
|
C.glutPostRedisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -62,6 +73,7 @@ func main() {
|
|||||||
C.glutCreateWindow(title)
|
C.glutCreateWindow(title)
|
||||||
|
|
||||||
C.setDisplayFunc()
|
C.setDisplayFunc()
|
||||||
|
C.setIdleFunc()
|
||||||
|
|
||||||
game := &DemoGame{}
|
game := &DemoGame{}
|
||||||
device = graphics.NewDevice(screenWidth, screenHeight, screenScale,
|
device = graphics.NewDevice(screenWidth, screenHeight, screenScale,
|
||||||
|
Loading…
Reference in New Issue
Block a user