Printing to the display
Due to the creative nature of me and a lot of other people, there's many functions to print to the display - but we'll be using just basic text.
Drawing text can be in a terminal way (just add text and the backend will manage text wrapping, coordinates, etc.) or in a low level, pick the coordinates where you want the text to appear way. We'll be using the easiest: the terminal way, in this example.
To start, create the terminal backend class.
Any ready-made UI functions will be accessible via the GUI sub-class. Unfortunately due to my stupidity you have to pass the tpil
argument to the functions in said subclass. Oops.
And to write text to the terminal console,
Our example should now look something like this:
Now if you try this code, it should run without errors. But you can't read anything. This is because:
So we should wait for our user to press a key this time.
To wait for the user's input, we'd use tpil.waitForKey()
.
Our code should look like this now:
Last updated