CHAPTER 15

Simple Drawing Editors


All the examples that we have considered in this chapter are of highly specialized drawing editors; they enable you to manipulate one very particular type of object.

- Menu Procedures:

15.6 Yes No

prog15_6.png

  1. void setup(){
  2. size(800,600);
  3. }
  4.  
  5. void draw(){
  6.  
  7. //Prompt the request
  8. text("CHOOSE BETWEEN... 1: YES 2: NO",10,90);
  9.  
  10. if(keyPressed){
  11. if(key == '1' || key == '2'){
  12. text(key,10,130);
  13. }else{
  14. text("ILLEGAL CHOICE - TRY AGAIN",10,130);
  15. }
  16. }
  17. }
  18.  

15.7 Vocabulary

prog15_7.png

  1. void setup(){
  2. size(800,600);
  3. }
  4.  
  5. void draw(){
  6.  
  7. //Prompt the request
  8. text("CHOOSE BETWEEN... ",10,80);
  9. text("1: VECTOR",10,100);
  10. text("2: ARC",10,120);
  11. text("3: CIRCLE",10,140);
  12. text("4: SQUARE",10,160);
  13. text("5: RECTANGLE",10,180);
  14.  
  15. if(keyPressed){
  16. if(key >= '1' && key <= '5'){
  17. text(key,50,200);
  18. }else{
  19. text("ILLEGAL CHOICE - TRY AGAIN",50,220);
  20. }
  21. }
  22. }
  23.  

Comments

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.