You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
//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(&world.StartMuted, "mute", false, "mute music") |
|
flag.IntVar(&world.Debug, "debug", 0, "debug level (0 - disabled, 1 - print fps and net stats, 2 - draw hitboxes)") |
|
flag.BoolVar(&printDebug, "debug-ggpo", false, "print GGPO debug messages") |
|
flag.IntVar(&world.TPS, "tps", world.DefaultTPS, "set ticks per second (this is not normally required)") |
|
flag.BoolVar(&world.Headless, "headless", false, "run in headless mode (for debug purposes)") |
|
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 |
|
} |
|
}
|
|
|