Now let’s try and draw some text on the screen. Contrary to the class Vec2, the Str class does not have a ‘draw’ method. The object D is used to show text on the screen:
Str myString;
myString = ”hello world”;
D.text(Vec2(0, 0), myString); // place text in the middle of the screen
D.text(Vec2(0, -0.1), ”Een string literal”); // or use a string literal
5
The second argument of the method text is the text itself. The first argument is the desired position. By now, you know enough about coordinates to understand why this has to be a Vec2.