Closed Elius94 closed 2 years ago
Now there's no more flickering in the screen! all the page is prerendered before printing on the console.
Introduced new styling design pattern:
Each page need to be created with the new class
const p = new PageBuilder()
and to add a styled row it's neccessary to call:
p.addRow({ text: ` 'm'`, color: 'gray', bold: true }, { text: ` - Select simulation mode`, color: 'white', italic: true })
The arguments of that function is an array of object (function arguments syntax, no []!), so in a row you can add different phrases with different styles.
The styles are converted to the Chalk modificator:
eg:
p.addRow({ text: `TCP messages sent:`, color: 'green', bg: 'bgRed', bold: true, italic: true, underline: true }, { text: ` ${tcpCounter}`, color: 'white' })
And so, we can add the PageBuilder to the home page
GUI.setHomePage(p)
The new Screen class is used internally by the ConsoleManager.
NEW DRAWING ALGORYTM
Now there's no more flickering in the screen! all the page is prerendered before printing on the console.
Introduced new styling design pattern:
Each page need to be created with the new class
and to add a styled row it's neccessary to call:
The arguments of that function is an array of object (function arguments syntax, no []!), so in a row you can add different phrases with different styles.
The styles are converted to the Chalk modificator:
colors:
Background colors ('bg')
Formatters (Each is a prop):
eg:
And so, we can add the PageBuilder to the home page
The new Screen class is used internally by the ConsoleManager.