mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +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 {
|
func update(screen *ebiten.Image) error {
|
||||||
text += string(ebiten.InputChars())
|
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") {
|
if ebiten.IsKeyPressed(ebiten.KeyEnter) && !strings.HasSuffix(text, "\n") {
|
||||||
text += "\n"
|
text += "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
counter++
|
counter++
|
||||||
|
|
||||||
if ebiten.IsRunningSlowly() {
|
if ebiten.IsRunningSlowly() {
|
||||||
|
Loading…
Reference in New Issue
Block a user