mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
36 lines
609 B
Go
36 lines
609 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"github.com/hajimehoshi/ebiten/ui"
|
|
"github.com/hajimehoshi/ebiten/ui/glfw"
|
|
"log"
|
|
"os"
|
|
"runtime"
|
|
"runtime/pprof"
|
|
)
|
|
|
|
func init() {
|
|
runtime.LockOSThread()
|
|
}
|
|
|
|
var cpuProfile = flag.String("cpuprofile", "", "write cpu profile to file")
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
if *cpuProfile != "" {
|
|
f, err := os.Create(*cpuProfile)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
pprof.StartCPUProfile(f)
|
|
defer pprof.StopCPUProfile()
|
|
}
|
|
|
|
u := new(glfw.UI)
|
|
game := NewGame()
|
|
if err := ui.Run(u, game, ScreenWidth, ScreenHeight, 2, "Ebiten Demo", 60); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|