You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
//go:build !js || !wasm
|
|
// +build !js !wasm
|
|
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"os"
|
|
|
|
"code.rocketnine.space/tslocum/boxbrawl/world"
|
|
"github.com/assemblaj/ggpo"
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
)
|
|
|
|
func parseFlags() {
|
|
var (
|
|
fullscreen bool
|
|
hostAddress string
|
|
connectAddress string
|
|
printDebug bool
|
|
)
|
|
flag.BoolVar(&fullscreen, "fullscreen", false, "run in fullscreen mode")
|
|
flag.StringVar(&hostAddress, "host", "", "start hosting a match on specified address:port")
|
|
flag.StringVar(&connectAddress, "connect", "", "connect to a match at specified address:port")
|
|
flag.IntVar(&world.LocalPort, "local", 0, "set local port (this is not normally required)")
|
|
flag.BoolVar(&printDebug, "debug", false, "enable printing debug messages")
|
|
flag.IntVar(&world.TPS, "tps", world.DefaultTPS, "set ticks per second (this is not normally required)")
|
|
flag.Parse()
|
|
|
|
if fullscreen {
|
|
ebiten.SetFullscreen(true)
|
|
}
|
|
|
|
if printDebug {
|
|
ggpo.SetLogger(log.New(os.Stderr, "GGPO ", log.Ldate|log.Ltime|log.Lmsgprefix))
|
|
}
|
|
|
|
if hostAddress != "" {
|
|
world.ConnectPromptHost = true
|
|
world.ConnectPromptText = hostAddress
|
|
world.ConnectPromptConfirmed = true
|
|
} else if connectAddress != "" {
|
|
world.ConnectPromptText = connectAddress
|
|
world.ConnectPromptConfirmed = true
|
|
}
|
|
}
|