Erase on showstring + showports improvements (#402)

* erase line before show string + show ports upgrade

* fixed font size

* fixing console output
This commit is contained in:
Peli de Halleux
2018-04-03 04:30:23 -07:00
committed by GitHub
parent 3339a7660a
commit 69194b0b76
3 changed files with 42 additions and 54 deletions

View File

@ -59,7 +59,6 @@ namespace console {
namespace console._screen {
const maxLines = 100;
const screenLines = 10;
let lines: string[];
let scrollPosition = 0;
@ -75,10 +74,11 @@ namespace console._screen {
function printLog() {
brick.clearScreen()
if (!lines) return;
const screenLines = brick.lineCount();
for (let i = 0; i < screenLines; ++i) {
const line = lines[i + scrollPosition];
if (line)
screen.print(line, 0, 4 + i * brick.LINE_HEIGHT)
screen.print(line, 0, 4 + i * brick.lineHeight(), 1, brick.font)
}
}
@ -98,6 +98,7 @@ namespace console._screen {
scrollPosition = Math.min(scrollPosition, lines.length - 1)
}
// move down scroll once it gets large than the screen
const screenLines = brick.lineCount();
if (lines.length > screenLines
&& lines.length >= scrollPosition + screenLines) {
scrollPosition++;