public void draw(int x, int y, int width, int height) {
    parent.fill(120);

    parent.textSize(20);
    parent.text(titulo, startAtX, startAtY - 22);
    parent.textSize(10);
    parent.text(eixoX + " x " + eixoY, startAtX, startAtY - 10);

    parent.textSize(squareSpace / 2);

    drawYAxis();
    drawXAxis();
    drawSquares();
  }
Пример #2
0
  /** Draws the histogram labels */
  protected void drawHistLabels() {
    parent.pushStyle();
    parent.textMode(MODEL);
    parent.textFont(font);
    parent.textSize(fontSize);
    parent.fill(fontColor);
    parent.noStroke();

    if (type == GPlot.VERTICAL) {
      if (rotateLabels) {
        parent.textAlign(RIGHT, CENTER);

        for (int i = 0; i < plotPoints.getNPoints(); i++) {
          if (plotPoints.isValid(i) && plotPoints.getX(i) >= 0 && plotPoints.getX(i) <= dim[0]) {
            parent.pushMatrix();
            parent.translate(plotPoints.getX(i), labelsOffset);
            parent.rotate(-HALF_PI);
            parent.text(plotPoints.getLabel(i), 0, 0);
            parent.popMatrix();
          }
        }
      } else {
        parent.textAlign(CENTER, TOP);

        for (int i = 0; i < plotPoints.getNPoints(); i++) {
          if (plotPoints.isValid(i) && plotPoints.getX(i) >= 0 && plotPoints.getX(i) <= dim[0]) {
            parent.text(plotPoints.getLabel(i), plotPoints.getX(i), labelsOffset);
          }
        }
      }
    } else {
      if (rotateLabels) {
        parent.textAlign(CENTER, BOTTOM);

        for (int i = 0; i < plotPoints.getNPoints(); i++) {
          if (plotPoints.isValid(i) && -plotPoints.getY(i) >= 0 && -plotPoints.getY(i) <= dim[1]) {
            parent.pushMatrix();
            parent.translate(-labelsOffset, plotPoints.getY(i));
            parent.rotate(-HALF_PI);
            parent.text(plotPoints.getLabel(i), 0, 0);
            parent.popMatrix();
          }
        }
      } else {
        parent.textAlign(RIGHT, CENTER);

        for (int i = 0; i < plotPoints.getNPoints(); i++) {
          if (plotPoints.isValid(i) && -plotPoints.getY(i) >= 0 && -plotPoints.getY(i) <= dim[1]) {
            parent.text(plotPoints.getLabel(i), -labelsOffset, plotPoints.getY(i));
          }
        }
      }
    }

    parent.popStyle();
  }
 public void hover() {
   PVector mouse = new PVector(parent.mouseX, parent.mouseY);
   int[] ponto = getSquare(mouse);
   if (ponto != null && ponto[QTD] > 0) {
     parent.textSize(16);
     parent.text(eixoY + ": " + (int) ponto[0], 200, high() + 16);
     parent.text(eixoX + ": " + (int) ponto[1], 200, high() + 32);
     parent.text(eixoZ + ": " + (int) ponto[2], 200, high() + 48);
   }
 }
Пример #4
0
  @Override
  public void display() {
    if (isDisplay) {
      context.fill(0, 80);
      // rect(xpos, ypos, width, width);
      context.fill(196, 196, 196, 80);
      context.ellipse(xpos + width / 2, ypos + width / 2, width, width);

      context.fill(255);
      context.ellipse(xpos + width / 2, ypos + width / 2, width / 2, width / 2);
      if (isSelected) {
        context.fill(255, 196, 13);
        context.ellipse(xpos + width / 2, ypos + width / 2, width / 2, width / 2);
      }
      context.fill(255);
      context.textSize(10);
      context.text("Bus Number", xpos - width, ypos + 3 * height / 2);
    }
  }
 public void hover(float w) {
   parent.textSize(16);
   parent.text(eixoW + ": " + w, 200, high() + 64);
 }
Пример #6
0
  public static void settingsScreen() {
    if (settings) {
      int bx = -15;
      int by = 830;

      // controls
      parent.image(controlsline, 45, 0);
      parent.image(moverl, 105, 100);
      parent.image(spaceShoot, 50, 150);
      parent.image(pauseimg, 145, 200);

      parent.image(buttonR, 500, 100);
      parent.image(buttonQ, 500, 155);
      parent.image(buttonM, 500, 210);

      parent.textSize(40);
      parent.text("Movement", 250, 150);
      parent.text("Shoot", 250, 200);
      parent.text("Pause", 250, 250);

      parent.text("Reset", 590, 150);
      parent.text("Quit", 590, 210);
      parent.text("Menu", 590, 265);

      // bullets
      parent.image(bulletsline, 45, 300);
      if (fireballCounter <= 10) { // firebullet animation
        fireballCounter = fireballCounter + 1;
        parent.image(bullet1, 270, 420);
      } else if (fireballCounter <= 15) {
        fireballCounter = fireballCounter + 1;
        parent.image(bullet2, 270, 420);
      } else if (fireballCounter <= 20) {
        fireballCounter = fireballCounter + 1;
        parent.image(bullet3, 270, 420);
      } else if (fireballCounter <= 25) {
        fireballCounter = fireballCounter + 1;
        parent.image(bullet4, 270, 420);
      } else {
        fireballCounter = 0;
        parent.image(bullet1, 270, 420);
      }
      parent.textSize(20);
      parent.text("Fireball", 250, 480);
      if (parent.mouseX > 230
          && parent.mouseX < 320
          && parent.mouseY > 420
          && parent.mouseY < 500) {
        if (parent.mousePressed) {
          fireVisualToggle = true;
          waterVisualToggle = false;
          regularVisualToggle = false;
          BulletsClass.fire = true;
          BulletsClass.water = false;
          BulletsClass.regular = false;
        }
      }
      if (fireVisualToggle) {
        parent.textSize(35);
        parent.text("^", 275, 510);
      }

      // waterbullet animation
      if (waterballCounter <= 10) {
        waterballCounter = waterballCounter + 1;
        parent.image(waterbullet1, 430, 420);
      } else if (waterballCounter <= 15) {
        waterballCounter = waterballCounter + 1;
        parent.image(waterbullet2, 430, 420);
      } else if (waterballCounter <= 20) {
        waterballCounter = waterballCounter + 1;
        parent.image(waterbullet3, 430, 420);
      } else if (waterballCounter <= 25) {
        waterballCounter = waterballCounter + 1;
        parent.image(waterbullet4, 430, 420);
      } else {
        waterballCounter = 0;
        parent.image(waterbullet1, 430, 420);
      }
      parent.textSize(20);
      parent.text("Waterball", 400, 480);
      if (parent.mouseX > 400
          && parent.mouseX < 510
          && parent.mouseY > 420
          && parent.mouseY < 485) {
        if (parent.mousePressed) {
          fireVisualToggle = false;
          waterVisualToggle = true;
          regularVisualToggle = false;
          BulletsClass.water = true;
          BulletsClass.fire = false;
          BulletsClass.regular = false;
        }
      }
      if (waterVisualToggle) {
        parent.textSize(35);
        parent.text("^", 440, 510);
      }

      // regular bullet
      parent.rect(130, 430, 5, 20);
      parent.textSize(20);
      parent.text("Regular", 100, 480);
      if (parent.mouseX > 100
          && parent.mouseX < 180
          && parent.mouseY > 420
          && parent.mouseY < 485) {
        parent.image(backbutton2, bx, by);
        if (parent.mousePressed) {
          fireVisualToggle = false;
          waterVisualToggle = false;
          regularVisualToggle = true;
          BulletsClass.water = false;
          BulletsClass.fire = false;
          BulletsClass.regular = true;
        }
      }
      if (regularVisualToggle) {
        parent.textSize(35);
        parent.text("^", 125, 510);
      }

      // difficulty
      parent.image(difficultyline, 45, 520);
      int easyx = 50;
      int easyy = 600;
      parent.image(easy, easyx, easyy);
      if (parent.mouseX > easyx + 16
          && parent.mouseX < easyx + 210
          && parent.mouseY > easyy + 20
          && parent.mouseY < easyy + 180) {
        parent.image(easy2, easyx, easyy);
        if (parent.mousePressed) {
          easyToggle = true;
          mediumToggle = false;
          hardToggle = false;
        }
      }

      int mediumx = 250;
      int mediumy = 600;
      parent.image(medium, mediumx, mediumy);
      if (parent.mouseX > mediumx + 16
          && parent.mouseX < mediumx + 210
          && parent.mouseY > mediumy + 20
          && parent.mouseY < mediumy + 180) {
        parent.image(medium2, mediumx, mediumy);
        if (parent.mousePressed) {
          easyToggle = false;
          mediumToggle = true;
          hardToggle = false;
        }
      }

      int hardx = 450;
      int hardy = 600;
      parent.image(hard, hardx, hardy);
      if (parent.mouseX > hardx + 16
          && parent.mouseX < hardx + 210
          && parent.mouseY > hardy + 20
          && parent.mouseY < hardy + 180) {
        parent.image(hard2, hardx, hardy);
        if (parent.mousePressed) {
          easyToggle = false;
          mediumToggle = false;
          hardToggle = true;
        }
      }
      if (easyToggle) {
        parent.image(easy2, easyx, easyy);
        AlienClass.xspeed1 = -1;
        AlienClass.alienShootSpeed = 140;
      }
      if (mediumToggle) {
        parent.image(medium2, mediumx, mediumy);
        AlienClass.xspeed1 = -3;
        AlienClass.alienShootSpeed = 100;
      }
      if (hardToggle) {
        parent.image(hard2, hardx, hardy);
        AlienClass.xspeed1 = -4;
        AlienClass.alienShootSpeed = 40;
      }

      // backbutton and rollover
      parent.image(backbutton, bx, by);
      if (parent.mouseX > bx + 60
          && parent.mouseX < bx + 210
          && parent.mouseY > by + 20
          && parent.mouseY < by + 60) {
        parent.image(backbutton2, bx, by);
        if (parent.mousePressed) {
          settings = false;
          splash = true;
        }
      }
    }
  }
Пример #7
0
  public static void highScoreScreen() {
    if (highscore) {
      int bx = -15;
      int by = 830;

      parent.image(topShooters, 0, 0);
      if (topshootCounter <= 30) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters2, 0, 0);
      }
      if (topshootCounter <= 60) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters3, 0, 0);
      }
      if (topshootCounter <= 90) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters4, 0, 0);
      }
      if (topshootCounter <= 120) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters5, 0, 0);
      }
      if (topshootCounter <= 120) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters6, 0, 0);
      }
      if (topshootCounter <= 130) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters, 0, 0);
      }
      if (topshootCounter <= 140) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters, 0, 0);
      }
      if (topshootCounter <= 150) {
        topshootCounter = topshootCounter + 1;
        parent.image(topShooters6, 0, 0);
      } else {
        topshootCounter = 0;
        parent.image(topShooters, 0, 0);
      }

      parent.textSize(80);
      parent.fill(255, 215, 0);
      parent.text(" 1.  " + scoreList.get(0), 285, 350);
      parent.fill(240, 230, 140);
      parent.text(" 2.  " + scoreList.get(1), 285, 450);
      parent.fill(255, 255, 255);
      parent.text(" 3.  " + scoreList.get(2), 285, 550);

      // backbutton and rollover
      parent.image(backbutton, bx, by);
      if (parent.mouseX > bx + 60
          && parent.mouseX < bx + 210
          && parent.mouseY > by + 20
          && parent.mouseY < by + 60) {
        parent.image(backbutton2, bx, by);
        if (parent.mousePressed) {
          highscore = false;
          splash = true;
        }
      }
    }
  }
Пример #8
0
  public static void drawVisuals() {
    // play button
    int pbx = 300;
    int pby = 400;
    // high score button
    int hx = 230;
    int hy = 500;
    // settings button
    int sx = 270;
    int sy = 600;
    // quit button
    int qx = 230;
    int qy = 700;
    // back button
    int bx = 50;
    int by = 50;

    if (splash) {
      // LOGO
      counter = counter + 1;
      if (counter < 10) parent.image(splash1, 115, 100);
      else if (counter < 20) parent.image(splash2, 115, 100);
      else if (counter < 30) parent.image(splash3, 115, 100);
      else if (counter < 40) parent.image(splash2, 115, 100);
      else if (counter < 50) parent.image(splash1, 115, 100);
      else {
        counter = 0;
        parent.image(splash1, 115, 100);
      }

      // MENU BUTTONS-------------------------

      // PLAY BUTTON
      parent.image(playbutton, pbx, pby);
      if (parent.mouseX > pbx
          && parent.mouseX < pbx + 200
          && parent.mouseY > pby
          && parent.mouseY < pby + 55) {
        parent.image(playbutton2, pbx, pby);
        if (parent.mousePressed) {
          if (mainClass.splash) {
            mainClass.alive = true;
            mainClass.splash = false;
          }
        }
      }

      // SETTING BUTTON
      parent.image(settingbutton, sx, sy);
      if (parent.mouseX > sx
          && parent.mouseX < sx + 250
          && parent.mouseY > sy
          && parent.mouseY < sy + 55) {
        parent.image(settingbutton2, sx, sy);
        if (parent.mousePressed) {
          splash = false;
          settings = true;
        }
      }

      // HIGHSCORE BUTTON
      parent.image(highscorebutton, hx, hy);
      if (parent.mouseX > hx
          && parent.mouseX < hx + 320
          && parent.mouseY > hy
          && parent.mouseY < hy + 55) {
        parent.image(highscorebutton2, hx, hy);
        if (parent.mousePressed) {
          splash = false;
          highscore = true;
        }
      }

      // QUIT BUTTON
      parent.image(quitbutton, qx, qy);
      if (parent.mouseX > qx + 120
          && parent.mouseX < qx + 230
          && parent.mouseY > qy + 15
          && parent.mouseY < qy + 55) {
        parent.image(quitbutton2, qx, qy);
        if (parent.mousePressed) {
          parent.exit();
        }
      }
      parent.textSize(12);
      parent.text("v1.18 - Tallah Khan-14017609 - Manchester Metropolitan University", 205, 880);
    }
  }