//Jeremy Turner (JOT) Project 2 #200024742 //Note: This simple drawing tool is in the process of being debugged. //please expect a few more days for the more robust version. //First I will declare the font... PFont font; PImage b; //this global variable indicates there will be an image downloaded //to the Assignment's folder called "b"...I will use this for the picture of Moses. PImage c; //Here I am calling up each tablet in the global variable section //to make sure they exist and are drawn. MyTablet t1; MyTablet t2; MyTablet t3; MyTablet t4; MyTablet t5; MyTablet t6; MyTablet t7; MyTablet t8; void setup () { size (400, 666); background(255); t1 = new MyTablet (10, 425); t2 = new MyTablet (100, 425); t3 = new MyTablet (200, 425); t4 = new MyTablet (300, 425); t5 = new MyTablet (10, 550); t6 = new MyTablet (100, 550); t7 = new MyTablet (200, 550); t8 = new MyTablet (300, 550); b = loadImage("moses460.jpg"); //the image assigned to the variable "b" is being told to upload within setup instead of a background. image(b,0,0); font = loadFont ("JuiceITC-Regular-28.vlw"); font = loadFont ("JuiceITC-Regular-36.vlw"); //this uploads the chosen font. font = loadFont ("JuiceITC-Regular-48.vlw"); } void draw () { background(255); changeCursor(); createText(); makeTablets(); //Pooya : I've put these line to void mousePressed() // if (mousePressed == true) // { // } image(b, 0, 0); } void mousePressed(){ if((t1.IsMouseOnTablet())||(t2.IsMouseOnTablet())||(t3.IsMouseOnTablet())||(t4.IsMouseOnTablet())||(t5.IsMouseOnTablet())||(t6.IsMouseOnTablet())||(t7.IsMouseOnTablet())||(t8.IsMouseOnTablet())) { line(mouseX, mouseY, pmouseX, pmouseY); stroke(0); strokeWeight(4); } } void mouseMoved() { //Pooya: it is not needed to add extra if(s) - if ( (a is true) || (b is true) || (c is true) ) if((t1.IsMouseOnTablet())||(t2.IsMouseOnTablet())||(t3.IsMouseOnTablet())||(t4.IsMouseOnTablet())||(t5.IsMouseOnTablet())||(t6.IsMouseOnTablet())||(t7.IsMouseOnTablet())||(t8.IsMouseOnTablet())) { line (pmouseX, pmouseY, mouseX, mouseY); smooth(); stroke (255); strokeWeight(2); } } void mouseDragged() { //Pooya: it is not needed to add extra if(s) - if ( (a is true) || (b is true) || (c is true) ) if((t1.IsMouseOnTablet())||(t2.IsMouseOnTablet())||(t3.IsMouseOnTablet())||(t4.IsMouseOnTablet())||(t5.IsMouseOnTablet())||(t6.IsMouseOnTablet())||(t7.IsMouseOnTablet())||(t8.IsMouseOnTablet())) { line (mouseX, mouseY, pmouseX, pmouseY); stroke (0); strokeWeight(4); } } void createText(){ textFont(font, 48); text("WRITTEN IN STONE...", 30,325); fill(0); textFont(font, 28); text("Preview Sketch = float mouse over a tablet", 30, 375); // text("Erase Preview = press left mouse button", 30, 385); text("Etch onto stone = drag mouse over a tablet", 30, 405); fill(255, 0, 0); } void makeTablets(){ //Pooya: Regarding to change made in constructor, these lines are not needed anymore. When you make an object (and calling the constructor) these lines would automatically be called // t1.loadtablet(); // t2.loadtablet(); // t3.loadtablet(); // t4.loadtablet(); // t5.loadtablet(); // t6.loadtablet(); // t7.loadtablet(); // t8.loadtablet(); t1.maketablet(); t2.maketablet(); t3.maketablet(); t4.maketablet(); t5.maketablet(); t6.maketablet(); t7.maketablet(); t8.maketablet(); } void changeCursor () { if((t1.IsMouseOnTablet())||(t2.IsMouseOnTablet())||(t3.IsMouseOnTablet())||(t4.IsMouseOnTablet())||(t5.IsMouseOnTablet())||(t6.IsMouseOnTablet())||(t7.IsMouseOnTablet())||(t8.IsMouseOnTablet())) { cursor(CROSS); } else { cursor(ARROW); } } class MyTablet { //the class of tablets has now been created... float xPos; float yPos; PImage c; // I have assigned this global variable for the picture of the stone tablet. int tabletWidth; int tabletHeight; MyTablet (float x, float y) { xPos = x; yPos = y; //Pooya: I added this line in constructor to make it run only once loadtablet(); } boolean IsMouseOnTablet(){ if (mouseX>xPos && mouseXyPos && mouseY