Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. PFont fnt1;
  2. String myText = "To be or not to be.";
  3. int myFontSize = 48;
  4. void setup(){
  5.  
  6. size( 600, 600 );
  7. fnt1 = createFont("Times New Roman", myFontSize ); fill( 0 ); // black
  8. textAlign( LEFT, TOP );
  9. textFont( fnt1 );
  10. }
  11.  
  12. void draw() {
  13. background(127);
  14. text( myText, mouseX, mouseY );
  15. // Top horizontal line.
  16. line(0, mouseY, width, mouseY);
  17. // Bottom horizontal line.
  18. line(0, mouseY+myFontSize, width, mouseY+myFontSize);
  19. // Left vertical line.
  20. line(mouseX, 0, mouseX, height);
  21. // Right vertical line.
  22. line(mouseX+textWidth(myText), 0, mouseX+textWidth(myText), height);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement