Closed wolfshirts closed 2 years ago
Please post a minimal executable code sample which reproduces this bug :)
Absolutely. Thanks!
import (
"fmt"
tl "github.com/JoelOtter/termloop"
)
func main() {
game := tl.NewGame()
game.Screen().SetFps(30)
x, y := game.Screen().Size()
textToDisplay := fmt.Sprintf("Current size x: %d y: %d", x, y)
text := tl.NewText(10, 10, textToDisplay, tl.ColorBlack, tl.ColorBlue)
game.Screen().AddEntity(text)
game.Start()
}
Looks like the same issue as https://github.com/JoelOtter/termloop/issues/13
TLDR: Screen size is not initialized before game.Start()
here https://github.com/JoelOtter/termloop/blob/master/game.go#L89
Yep that'll do it :) Until the game has actually started Termloop doesn't know anything about your terminal. Should probably document that but I am still vaguely intending to do a full rewrite of this library given it's very old at this point...
Maybe just an issue with my code, but I seem to be getting 0 back for game.Screen().Size() both width, and height.