43 lines
1.4 KiB
Go
43 lines
1.4 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"
|
|
)
|
|
|
|
func parseFlags() {
|
|
var (
|
|
hostAddress string
|
|
connectAddress string
|
|
printDebug bool
|
|
)
|
|
flag.BoolVar(&world.Fullscreen, "fullscreen", false, "run in fullscreen mode")
|
|
flag.BoolVar(&world.DisableVsync, "no-vsync", false, "do not enable vsync (allows the game to run at maximum fps)")
|
|
flag.StringVar(&hostAddress, "host", "", "start hosting a match against a remote opponent at the specified address:port")
|
|
flag.StringVar(&connectAddress, "connect", "", "connect to a match hosted by a remote opponent at the specified address:port")
|
|
flag.IntVar(&world.LocalPort, "local", 0, "set local port (this should be different from your opponent's local port)")
|
|
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 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
|
|
}
|
|
}
|