Add title

This commit is contained in:
Hajime Hoshi 2013-07-07 01:45:19 +09:00
parent 9b324a7e11
commit 239f008045
2 changed files with 7 additions and 7 deletions

View File

@ -60,5 +60,5 @@ func main() {
} }
const screenScale = 2 const screenScale = 2
glut.Run(game, screenScale) glut.Run(game, screenScale, "Ebiten Demo")
} }

View File

@ -96,7 +96,7 @@ func idle() {
C.glutPostRedisplay() C.glutPostRedisplay()
} }
func new(screenWidth, screenHeight, screenScale int) *GlutUI { func new(screenWidth, screenHeight, screenScale int, title string) *GlutUI {
ui := &GlutUI{ ui := &GlutUI{
glutInputting: make(chan glutInputEvent, 10), glutInputting: make(chan glutInputEvent, 10),
updating: make(chan chan func()), updating: make(chan chan func()),
@ -119,20 +119,20 @@ func new(screenWidth, screenHeight, screenScale int) *GlutUI {
C.int(screenWidth*screenScale), C.int(screenWidth*screenScale),
C.int(screenHeight*screenScale)) C.int(screenHeight*screenScale))
title := C.CString("Ebiten Demo") cTitle := C.CString(title)
defer C.free(unsafe.Pointer(title)) defer C.free(unsafe.Pointer(cTitle))
C.glutCreateWindow(title) C.glutCreateWindow(cTitle)
C.setGlutFuncs() C.setGlutFuncs()
return ui return ui
} }
func Run(game ebiten.Game, screenScale int) { func Run(game ebiten.Game, screenScale int, title string) {
screenWidth := game.ScreenWidth() screenWidth := game.ScreenWidth()
screenHeight := game.ScreenHeight() screenHeight := game.ScreenHeight()
ui := new(screenWidth, screenHeight, screenScale) ui := new(screenWidth, screenHeight, screenScale, title)
currentUI = ui currentUI = ui
graphicsDevice := opengl.NewDevice( graphicsDevice := opengl.NewDevice(