move to codeberg (#10)

This commit is contained in:
T. von Dein
2025-11-13 21:30:44 +01:00
parent a115db60f6
commit fee8aaeed9
34 changed files with 220 additions and 147 deletions

56
main.go Normal file
View File

@@ -0,0 +1,56 @@
package main
import (
"fmt"
"log"
"os"
"runtime/pprof"
_ "net/http/pprof"
"codeberg.org/scip/golsky/cmd"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
var directstart bool
if len(os.Args) > 1 {
directstart = true
}
config, err := cmd.ParseCommandline()
if err != nil {
log.Fatal(err)
}
if config.ShowVersion {
fmt.Printf("This is golsky version %s\n", cmd.VERSION)
os.Exit(0)
}
start := cmd.Play
if !directstart {
start = cmd.Menu
config.DelayedStart = true
}
game := cmd.NewGame(config, cmd.SceneName(start))
if config.ProfileFile != "" {
// enable cpu profiling. Do NOT use q to stop the game but
// close the window to get a profile
fd, err := os.Create(config.ProfileFile)
if err != nil {
log.Fatal(err)
}
defer fd.Close()
pprof.StartCPUProfile(fd)
defer pprof.StopCPUProfile()
}
// main loop
if err := ebiten.RunGame(game); err != nil {
log.Fatal(err)
}
}