Mercurial > games > semicongine
comparison tests/test_font.nim @ 415:25db1fa56cb7
add: font/text improvments, support for newline rendering
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 27 Jan 2024 00:31:11 +0700 |
parents | 8fb4387b2ea1 |
children | 73cca428e27a |
comparison
equal
deleted
inserted
replaced
414:0deefe1c8af6 | 415:25db1fa56cb7 |
---|---|
25 if engine.keyWasPressed(c): | 25 if engine.keyWasPressed(c): |
26 if engine.keyIsDown(ShiftL) or engine.keyIsDown(ShiftR): | 26 if engine.keyIsDown(ShiftL) or engine.keyIsDown(ShiftR): |
27 textbox.text = textbox.text & ($c).toRunes | 27 textbox.text = textbox.text & ($c).toRunes |
28 else: | 28 else: |
29 textbox.text = textbox.text & ($c).toRunes[0].toLower() | 29 textbox.text = textbox.text & ($c).toRunes[0].toLower() |
30 if engine.keyWasPressed(Enter): | |
31 textbox.text = textbox.text & Rune('\n') | |
30 if engine.keyWasPressed(Space): | 32 if engine.keyWasPressed(Space): |
31 textbox.text = textbox.text & " ".toRunes[0] | 33 textbox.text = textbox.text & Rune(' ') |
32 if engine.keyWasPressed(Backspace) and textbox.text.len > 0: | 34 if engine.keyWasPressed(Backspace) and textbox.text.len > 0: |
33 textbox.text = textbox.text[0 ..< ^1] | 35 textbox.text = textbox.text[0 ..< ^1] |
34 engine.renderScene(scene) | 36 engine.renderScene(scene) |
35 engine.destroy() | 37 engine.destroy() |
36 | 38 |