2013-07-05 15:25:45 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-10-14 04:34:58 +02:00
|
|
|
"github.com/hajimehoshi/go-ebiten"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/blank"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/input"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/monochrome"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/rects"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/rotating"
|
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/sprites"
|
2013-10-18 19:58:00 +02:00
|
|
|
"github.com/hajimehoshi/go-ebiten/example/game/testpattern"
|
2013-10-14 04:34:58 +02:00
|
|
|
"github.com/hajimehoshi/go-ebiten/ui/cocoa"
|
2013-07-05 15:25:45 +02:00
|
|
|
"os"
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
|
|
|
|
|
gameName := ""
|
|
|
|
if 2 <= len(os.Args) {
|
|
|
|
gameName = os.Args[1]
|
|
|
|
}
|
|
|
|
|
|
|
|
var game ebiten.Game
|
|
|
|
switch gameName {
|
|
|
|
case "blank":
|
|
|
|
game = blank.New()
|
|
|
|
case "input":
|
|
|
|
game = input.New()
|
|
|
|
case "monochrome":
|
|
|
|
game = monochrome.New()
|
|
|
|
case "rects":
|
|
|
|
game = rects.New()
|
2013-10-15 02:12:43 +02:00
|
|
|
default:
|
|
|
|
fallthrough
|
2013-07-05 15:25:45 +02:00
|
|
|
case "rotating":
|
|
|
|
game = rotating.New()
|
|
|
|
case "sprites":
|
|
|
|
game = sprites.New()
|
2013-10-18 19:58:00 +02:00
|
|
|
case "testpattern":
|
|
|
|
game = testpattern.New()
|
2013-07-05 15:25:45 +02:00
|
|
|
}
|
|
|
|
|
2013-10-15 02:12:43 +02:00
|
|
|
const screenWidth = 256
|
|
|
|
const screenHeight = 240
|
2013-07-05 15:25:45 +02:00
|
|
|
const screenScale = 2
|
2013-10-15 02:12:43 +02:00
|
|
|
const title = "Ebiten Demo"
|
2013-11-22 18:56:18 +01:00
|
|
|
ui := cocoa.New(screenWidth, screenHeight, screenScale, title)
|
|
|
|
ui.Start(game)
|
|
|
|
ui.InitTextures(game)
|
|
|
|
for {
|
|
|
|
ui.WaitEvents()
|
|
|
|
ui.Draw(game.Draw)
|
2013-10-15 02:12:43 +02:00
|
|
|
}
|
2013-07-05 15:25:45 +02:00
|
|
|
}
|