|
|
|
@ -17,8 +17,8 @@ import (
|
|
|
|
|
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const uiStartPrompt = `Box Brawl
|
|
|
|
|
`
|
|
|
|
|
const uiStartPrompt = `BOX BRAWL`
|
|
|
|
|
const uiBrowserIntro = `Click anywhere to enable keyboard input.`
|
|
|
|
|
const uiComputerPrompt = `Press <Enter> to play against the computer.`
|
|
|
|
|
const uiHostPrompt = `Press <H> to host a match against a remote player.`
|
|
|
|
|
const uiHostInfoPrompt = `Type your opponent's IP address and port (address:port) to host a match.`
|
|
|
|
@ -66,6 +66,7 @@ func (u *UISystem) updateBuffer() {
|
|
|
|
|
prompt := []byte(uiStartPrompt)
|
|
|
|
|
|
|
|
|
|
if world.WASM {
|
|
|
|
|
prompt = append(prompt, []byte("\n\n"+uiBrowserIntro)...)
|
|
|
|
|
prompt = append(prompt, []byte("\n\n"+uiComputerPrompt)...)
|
|
|
|
|
prompt = append(prompt, []byte("\n\n"+uiBrowserPrompt)...)
|
|
|
|
|
} else if world.ConnectionActive {
|
|
|
|
@ -313,8 +314,10 @@ func (u *UISystem) Draw(e gohan.Entity, screen *ebiten.Image) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if world.Debug != 0 {
|
|
|
|
|
var ping int64
|
|
|
|
|
var framesBehind float64
|
|
|
|
|
var (
|
|
|
|
|
ping int64
|
|
|
|
|
framesBehind float64
|
|
|
|
|
)
|
|
|
|
|
if !world.ConnectPromptVisible && !world.Local {
|
|
|
|
|
p1Stats, err := world.Backend.GetNetworkStats(ggpo.PlayerHandle(1))
|
|
|
|
|
if err != nil {
|
|
|
|
@ -333,18 +336,26 @@ func (u *UISystem) Draw(e gohan.Entity, screen *ebiten.Image) error {
|
|
|
|
|
ping = yourStats.Network.Ping
|
|
|
|
|
framesBehind = math.Round(float64(yourStats.Timesync.LocalFramesBehind))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
framesLabel := "AHEAD"
|
|
|
|
|
if framesBehind > 0 {
|
|
|
|
|
framesLabel = "BEHIND"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
tps float64
|
|
|
|
|
fps float64
|
|
|
|
|
)
|
|
|
|
|
if !world.Headless {
|
|
|
|
|
tps = ebiten.ActualTPS()
|
|
|
|
|
fps = ebiten.ActualFPS()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
debugText := fmt.Sprintf("FRAMES %s %.0f\nPING %d\nTPS %0.0f\nFPS %0.0f",
|
|
|
|
|
framesLabel,
|
|
|
|
|
math.Abs(framesBehind),
|
|
|
|
|
ping,
|
|
|
|
|
ebiten.ActualTPS(),
|
|
|
|
|
ebiten.ActualFPS())
|
|
|
|
|
tps,
|
|
|
|
|
fps)
|
|
|
|
|
ebitenutil.DebugPrintAt(screen, debugText, 2, 0)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|