mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
examples/runes: Trim the text if it has too many lines
This commit is contained in:
parent
3f52fb951b
commit
193e473381
@ -31,9 +31,14 @@ var (
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
text += string(ebiten.InputChars())
|
||||
ss := strings.Split(text, "\n")
|
||||
if len(ss) > 10 {
|
||||
text = strings.Join(ss[len(ss)-10:], "\n")
|
||||
}
|
||||
if ebiten.IsKeyPressed(ebiten.KeyEnter) && !strings.HasSuffix(text, "\n") {
|
||||
text += "\n"
|
||||
}
|
||||
|
||||
counter++
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
|
Loading…
Reference in New Issue
Block a user