Ejemplo n.º 1
0
 public void render(Graphics g) {
   g.drawRect(
       (float) area.min.x,
       (float) area.min.y,
       (float) area.getWidth(),
       (float) area.getHeight());
 }
Ejemplo n.º 2
0
  @Override
  public void draw(GameContainer gc, Graphics g) {
    g.setDrawMode(Graphics.MODE_ADD);
    particleEngine.draw(gc, g);
    g.setDrawMode(Graphics.MODE_NORMAL);

    if (alive) {
      image.setCenterOfRotation(image.getWidth() / 2, image.getHeight() / 2);
      image.setRotation(rotation);

      //                g.setColor(new org.newdawn.slick.Color(0,0,120));
      //                g.drawRect(position.x, position.y - image.getHeight() / 2, image.getWidth(),
      // 4);
      //                g.fillRect(position.x, position.y - image.getHeight() / 2, image.getWidth()
      // * sheld / 100, 4);
      //
      g.setColor(new org.newdawn.slick.Color(0, 120, 23));
      g.drawRect(position.x, position.y - image.getHeight() / 2 - 6, image.getWidth(), 4);
      g.fillRect(
          position.x, position.y - image.getHeight() / 2 - 6, image.getWidth() * hull / 100, 4);
      //
      //                g.drawRect(position.x + image.getWidth() / 2 - 16, position.y +
      // image.getHeight() / 2 - 16, 32, 32);

      g.drawImage(image, position.x, position.y);

      for (int i = 0; i < 50; i++) {
        bullet[i].draw(gc, g);
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 public void render(GUIContext container, Graphics g) {
   g.setColor(Color.black);
   g.drawRect(x, y, width, height);
   area.render(container, g);
   g.drawString("" + shortcut, x + 2, y + 2);
 }
Ejemplo n.º 4
0
  @Override
  public void renderWindow(Graphics gfx, Window w) {
    int x = w.getAbsoluteX();
    int y = w.getAbsoluteY();

    gfx.setColor(backColor1);
    gfx.fillRect(x, y, w.getWidth(), w.getHeight());
    gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, w.getWidth(), w.getHeight());
  }
Ejemplo n.º 5
0
  @Override
  public void renderPanel(Graphics gfx, Panel w) {
    int x = w.getAbsoluteX();
    int y = w.getAbsoluteY();
    // TODO translate into widgets render() method

    gfx.setColor(backColor1);
    gfx.fillRect(x, y, w.getWidth(), w.getHeight());
    gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, w.getWidth(), w.getHeight());
  }
Ejemplo n.º 6
0
 @Override
 public void Draw(GameContainer gc, StateBasedGame arg1, Graphics g) {
   if (Visible) {
     if (height == 1) {
       height = g.getFont().getLineHeight();
     }
     g.setColor(Color.black);
     g.fillRect(getX(), getY(), width, height);
     g.setColor(Color.white);
     g.drawRect(getX(), getY(), width, height);
     g.drawString(text, getX() + 2, getY() + 1);
   }
 }
Ejemplo n.º 7
0
  /**
   * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
   */
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    String text = "abc";
    font.drawString(610, 100, text);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
    font.drawString(610, 150, text);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);

    g.translate(-50, -130);
    g.scale(10, 10);
    font.drawString(0, 0, text);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
    font.drawString(0, 26, text);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);

    g.resetTransform();
    g.setColor(Color.lightGray);
    g.drawString("Original Size on Sheet", 620, 210);
    g.drawString("10x Scale Up", 40, 575);

    g.setColor(Color.darkGray);
    g.drawRect(40, 40, 560, 530);
    g.drawRect(610, 105, 150, 100);

    g.setColor(Color.white);
    g.drawString("512x512 Font Sheet", 620, 300);
    g.drawString("NEHE Charset", 620, 320);
    g.drawString("4096x4096 (8x) Source Image", 620, 340);
    g.drawString("ScanSize = 20", 620, 360);
  }
Ejemplo n.º 8
0
 /*    */ public void render(GameContainer container, Graphics g) /*    */ throws SlickException
       /*    */ {
   /* 41 */ g.setColor(new Color(0.4F, 0.6F, 0.8F));
   /* 42 */ g.fillRect(0.0F, 0.0F, 1024.0F, 568.0F);
   /* 43 */ g.setColor(Color.white);
   /* 44 */ g.drawRect(5.0F, 5.0F, 1014.0F, 558.0F);
   /*    */
   /* 46 */ g.setColor(Color.white);
   /* 47 */ g.drawString(
       container.getInput().getMouseX() + "," + container.getInput().getMouseY(), 10.0F, 400.0F);
   /* 48 */ g.setColor(Color.red);
   /* 49 */ g.fillOval(
       container.getInput().getMouseX() - 10, container.getInput().getMouseY() - 10, 20.0F, 20.0F);
   /*    */ }
Ejemplo n.º 9
0
  /** @see AbstractComponent#render(GUIContext, org.newdawn.slick.Graphics) */
  public void render(GUIContext container, Graphics g) {
    if (lastKey != -1) {
      if (input.isKeyDown(lastKey)) {
        if (repeatTimer < System.currentTimeMillis()) {
          repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
          keyPressed(lastKey, lastChar);
        }
      } else {
        lastKey = -1;
      }
    }
    Rectangle oldClip = g.getClip();
    g.setWorldClip(x, y, width, height);

    // Someone could have set a color for me to blend...
    Color clr = g.getColor();

    if (background != null) {
      g.setColor(background.multiply(clr));
      g.fillRect(x, y, width, height);
    }
    g.setColor(text.multiply(clr));
    Font temp = g.getFont();

    int cpos = font.getWidth(value.substring(0, cursorPos));
    int tx = 0;
    if (cpos > width) {
      tx = width - cpos - font.getWidth("_");
    }

    g.translate(tx + 2, 0);
    g.setFont(font);
    g.drawString(value, x + 1, y + 1);

    if (hasFocus() && visibleCursor) {
      g.drawString("_", x + 1 + cpos + 2, y + 1);
    }

    g.translate(-tx - 2, 0);

    if (border != null) {
      g.setColor(border.multiply(clr));
      g.drawRect(x, y, width, height);
    }
    g.setColor(clr);
    g.setFont(temp);
    g.clearWorldClip();
    g.setClip(oldClip);
  }
Ejemplo n.º 10
0
  @Override
  public void renderWindowCloseButton(Graphics gfx, Button w) {
    int x = w.getAbsoluteX();
    int y = w.getAbsoluteY();

    gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, w.getWidth(), w.getHeight());

    if (w.isMouseOver()) gfx.setColor(Color.white);
    else gfx.setColor(Color.black);

    gfx.drawLine(x, y, x + w.getWidth(), y + w.getHeight());
    gfx.drawLine(x, y + w.getHeight(), x + w.getWidth(), y);
  }
  private void renderMinimap() {
    int minimapWidth = minimapBg.getWidth();
    int minimapHeight = minimapBg.getHeight();

    int boundaryWidth = boundarySystem.getBoundaryWidth();
    int boundaryHeight = boundarySystem.getBoundaryHeight();

    float scaleX = (float) minimapWidth / (float) boundaryWidth;
    float scaleY = (float) minimapHeight / (float) boundaryHeight;

    g.setColor(Color.white);

    g.translate(container.getWidth() - minimapWidth - 20, 20);
    {
      minimapBg.draw();

      float offsetX = cameraSystem.getStartX();
      float offsetY = cameraSystem.getStartY();
      g.drawRect(
          offsetX * scaleX,
          offsetY * scaleY,
          scaleX * cameraSystem.getWidth(),
          scaleY * cameraSystem.getHeight());

      ImmutableBag<Entity> entities = world.getManager(GroupManager.class).getEntities("crates");
      for (int i = 0; entities.size() > i; i++) {
        Entity crate = entities.get(i);
        Physics cratePhysics = physicsMapper.get(crate);
        float crateX = cratePhysics.getX() * scaleX;
        float crateY = cratePhysics.getY() * scaleY;
        g.fillRect(crateX - 1, crateY - 1, 2, 2);
      }

      ImmutableBag<Entity> tanks = world.getManager(GroupManager.class).getEntities("tanks");
      for (int i = 0; tanks.size() > i; i++) {
        Entity t = tanks.get(i);
        String tp = world.getManager(PlayerManager.class).getPlayer(t);
        Physics physics = physicsMapper.get(t);
        g.setColor(Color.green);
        float tx = physics.getX() * scaleX;
        float ty = physics.getY() * scaleY;
        g.fillRect(tx - 3, ty - 3, 6, 6);
      }
    }
    g.translate(-container.getWidth() + minimapWidth + 20, -20);
  }
Ejemplo n.º 12
0
  @Override
  public void renderWindowTitleBar(Graphics gfx, WindowTitleBar w) {
    int x = w.getAbsoluteX();
    int y = w.getAbsoluteY();

    gfx.setColor(backColor2);
    gfx.fillRect(x, y, w.getWidth(), w.getHeight());
    gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, w.getWidth(), w.getHeight());

    // Title
    if (w.getText() != null) {
      gfx.setColor(textColor);
      gfx.drawString(w.getText(), x + 8, y + 2);
    }
  }
Ejemplo n.º 13
0
  // This method draws when c is still (either player move or not, don't care)
  public void draw(int x_tile_dist, int y_tile_dist, Graphics g) {
    getPic()
        .draw(
            Map.X_OFFSET + (x_tile_dist * Map.SIZE_OF_TILE),
            (y_tile_dist * Map.SIZE_OF_TILE) + Map.Y_OFFSET);

    if (attacked) {
      g.setColor(RED);
      g.drawRect(
          Map.X_OFFSET + (x_tile_dist * Map.SIZE_OF_TILE),
          (y_tile_dist * Map.SIZE_OF_TILE) + Map.Y_OFFSET,
          Map.SIZE_OF_TILE,
          Map.SIZE_OF_TILE);
      g.setColor(BLACK);
    }
    status.draw(x_tile_dist, y_tile_dist);
  }
Ejemplo n.º 14
0
  @Override
  public void draw(Graphics g) {

    int width = getWidth();
    int height = getHeight();

    if (width == -1 || height == -1) return;

    g.setClip(getRealX(), getRealY(), width, height);

    if (this.hasBackground()) g.setColor(getBackground());
    else g.setColor(Color.darkGray);

    g.fillRect(getRealX(), getRealY(), width, height);

    if (this.hasBorder()) g.setColor(getBorder().getColor());
    else g.setColor(new Color(150, 150, 150));

    g.drawRect(getRealX(), getRealY(), width - 1, height - 1);

    if (hasText()) {

      g.setColor(getTextColor());

      int x = getRealX(), y = getRealY();

      if (textcenterx) {
        x -= g.getFont().getWidth(getDisplayText()) / 2;

        if (hasWidth()) x += getWidth() / 2;
      }

      if (textcentery) {
        y -= g.getFont().getHeight(getDisplayText()) / 2;

        if (hasHeight()) y += getHeight() / 2;
      }

      g.drawString(getDisplayText(), x, y);
    }

    g.clearClip();
  }
Ejemplo n.º 15
0
  public void renderButton(Graphics gfx, Button b, String text, Image icon) {
    int x = b.getAbsoluteX();
    int y = b.getAbsoluteY();

    if (b.isPressed()) gfx.setColor(backColor1);
    else gfx.setColor(backColor2);
    gfx.fillRect(x, y, b.getWidth(), b.getHeight());

    if (b.isMouseOver()) gfx.setColor(Color.white);
    else gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, b.getWidth(), b.getHeight());

    if (icon != null) gfx.drawImage(icon, x, y);

    if (text != null) {
      if (b.isEnabled()) gfx.setColor(Color.white);
      else gfx.setColor(Color.black);
      gfx.drawString(text, x + 4, y + 2);
    }
  }
Ejemplo n.º 16
0
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    int xStep = container.getWidth() / segments.length;
    int middle = container.getHeight() / 2;

    for (int idx = 0; idx < segments.length; idx++) {
      Segment segment = segments[idx];

      g.setColor(Color.yellow);
      render(g, segment.getLinear(), xStep, idx, middle);

      g.setColor(Color.green);
      render(g, segment.getCosine(), xStep, idx, middle);

      g.setColor(Color.cyan);
      render(g, segment.getCubic(), xStep, idx, middle);

      g.setColor(Color.red);
      g.drawRect(idx * xStep - 1, middle + segment.getStart() - 1, 2, 2);
    }
  }
Ejemplo n.º 17
0
  /**
   * Renders the player to the screen
   *
   * @param x the x position to render the player to
   * @param y the y position to render the player to
   * @param g the graphics context
   * @param viewerRole the role of the one viewing this player
   */
  public void draw(float x, float y, Graphics g, Role viewerRole) {

    if (Role.isRestriced(viewerRole) && "Fuzzi_Traitor.png".equals(texture)) {
      image = RessourceManager.loadImage("Fuzzi_Innocent.png");
    } else image = RessourceManager.loadImage(texture);

    image.rotate(lookAngle - image.getRotation() + 90);
    image.draw(x, y);

    if (this.getInventory()[this.getCurrentWeapon()] != null)
      this.getInventory()[this.getCurrentWeapon()].draw(x, y);

    g.setColor(Color.black);
    g.drawRect(x, y - 12, 32, 8);
    g.setColor(Color.red);
    g.fillRect(x + 1, y - 11, lifepoints * 0.31f, 7);

    Vector2f v = new Vector2f(x + 16, y + 16);
    Vector2f v1 = new Vector2f(getLookAngle()).scale(130f);
    Vector2f v2 = v.copy().add(v1);

    g.drawLine(v.x, v.y, v2.x, v2.y);
  }
Ejemplo n.º 18
0
  public void render(GameContainer gc, Graphics gfx) throws SlickException {
    Point pt = playMap.getPos();
    if (path != null) {
      for (int i = 0; i < path.getLength(); i++) {
        Path.Step step = path.getStep(i);
        gfx.setColor(Color.white);
        gfx.drawRect(
            pt.getX() + step.getX() * playMap.getTileWidth(),
            pt.getY() + step.getY() * playMap.getTileHeight(),
            playMap.getTileWidth(),
            playMap.getTileHeight());
      }
    }

    if (pathStep != null) {
      Point foe = new Point(pt);
      gfx.drawOval(
          foe.getX() + pathStep.getX() * playMap.getTileWidth() + 4,
          foe.getY() + pathStep.getY() * playMap.getTileHeight() + 4,
          9,
          9);
    }
  }
Ejemplo n.º 19
0
 public void drawARectangle(Graphics g) {
   g.drawRect((int) (this.xPos - 55f), (int) (this.yPos - 35f), 150, 150);
 }
Ejemplo n.º 20
0
 public void drawRectangle(Graphics g) {
   g.drawRect(this.xPos, this.yPos, 32, 64);
 }
Ejemplo n.º 21
0
  public void drawMovingNoCreatureMov(Player player, int x_tile_dist, int y_tile_dist, Graphics g) {
    {
      float p_part = (float) player.getInputDelta() / (float) player.getSpeed();
      int p_offset = (int) (p_part * Map.SIZE_OF_TILE);

      // System.out.println(part);
      // System.out.println(offset);

      int x_move = ((Player.getPlayerXCenter() + x_tile_dist) * Map.SIZE_OF_TILE) + Map.X_OFFSET;
      int y_move = ((Player.getPlayerYCenter() + y_tile_dist) * Map.SIZE_OF_TILE) + Map.Y_OFFSET;

      int tile = Map.SIZE_OF_TILE;

      int actual_x = 0;
      int actual_y = 0;
      switch (player.getMoving()) {
        case 1:
          actual_x = x_move - tile + p_offset;
          actual_y = y_move + tile - p_offset;
          break;
        case 2:
          actual_x = x_move;
          actual_y = y_move + tile - p_offset;
          break;
        case 3:
          actual_x = x_move + tile - p_offset;
          actual_y = y_move + tile - p_offset;
          break;
        case 4:
          actual_x = x_move - tile + p_offset;
          actual_y = y_move;
          break;
        case 6:
          actual_x = x_move + tile - p_offset;
          actual_y = y_move;
          break;
        case 7:
          actual_x = x_move - tile + p_offset;
          actual_y = y_move + p_offset - tile;
          break;
        case 8:
          actual_x = x_move;
          actual_y = y_move + p_offset - tile;
          break;
        case 9:
          actual_x = x_move + tile - p_offset;
          actual_y = y_move + p_offset - tile;
          break;
      }

      getPic().draw(actual_x, actual_y);

      if (attacked) {
        g.setColor(RED);
        g.drawRect(actual_x, actual_y, Map.SIZE_OF_TILE, Map.SIZE_OF_TILE);
        g.setColor(BLACK);
      }

      getStatus().drawMoveMonster(actual_x, actual_y);
    }
  }
Ejemplo n.º 22
0
  /** Renderiza el juego, uso interno */
  @Override
  public void render(GameContainer gc, Graphics g) throws SlickException {
    double escalaTemporal = 0;
    if (autoescala) {
      escalaTemporal = escala;
      if (!noAutoEscalar) {
        escala = Math.min(escala, escalaAjustada);
        if (partido.getIteracion() < 50) {
          escalaGradual = escalaGradual + (escala - escalaGradual) * 0.01;
        } else {
          escalaGradual = escalaGradual + (escala - escalaGradual) * 0.2;
        }
      }

      escala = escalaGradual;
    }
    Position p = new Position(px, py);
    if (entorno) {
      pc.pintaEntorno(g, p, escala);
    }
    pc.pintaCancha(g, p, escala);
    Position[][] pos = partido.getPosiciones();
    if (!partido.esGol() && partido.estanSacando()) {
      double zoom = 1 * escala * (1 + 0.02 * (double) iterSaca);
      rel =
          Transforma.transform(
              pos[2][0],
              Constants.centroCampoJuego,
              -Transforma.transform(px, escala) + sx2,
              -Transforma.transform(py, escala) + sy2,
              escala);
      g.drawImage(
          xImage.getScaledCopy((int) zoom, (int) zoom),
          rel[0] - (int) (zoom / 2),
          rel[1] - (int) (zoom / 2));
    }
    Position ball = partido.getPosVisibleBalon();
    for (int i = 0; i < 11; i++) {
      rel =
          Transforma.transform(
              pos[0][i],
              Constants.centroCampoJuego,
              -Transforma.transform(px, escala) + sx2,
              -Transforma.transform(py, escala) + sy2,
              escala);
      pjLocal.pintaSombra(i, iteraciones[i][0], angVisible[i][0], escala, rel[0], rel[1], g);
      rel =
          Transforma.transform(
              pos[1][i],
              Constants.centroCampoJuego,
              -Transforma.transform(px, escala) + sx2,
              -Transforma.transform(py, escala) + sy2,
              escala);
      pjVisita.pintaSombra(i, iteraciones[i][1], angVisible[i][1], escala, rel[0], rel[1], g);
    }
    z = partido.getAlturaBalon(); // 16*Math.sin(Math.abs(ang % Math.PI));

    if (partido.estaRebotando() || z == 0) {
      ang = -balon0.angle(ball);
      velgiro = balon0.distance(ball) * 1.5;
    }
    if (partido.estanRematando()) {
      ang = rand.nextDouble() * Math.PI * 2;
      velgiro = rand.nextDouble();
    }

    balon0 = ball;
    giro = giro + velgiro * 1.5;
    if (giro < 0) {
      giro = 6 + giro;
    }
    rel =
        Transforma.transform(
            ball,
            Constants.centroCampoJuego,
            -Transforma.transform(px, escala) + sx2,
            -Transforma.transform(py, escala) + sy2,
            escala);
    pb.pintaSombra(escala, rel[0], rel[1], z, g);
    if (partido.getAlturaBalon() <= 2) {
      pb.pintaBalon((int) (giro), ang, escala, rel[0], rel[1], z * 2, g);
    }
    pp.pintaPublicidad(g, p, escala);

    if (jugador3d) {
      lista.clear();
      for (int i = 0; i < 11; i++) {
        rel =
            Transforma.transform(
                pos[0][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        lista.add(
            new Object[] {pjLocal, i, iteraciones[i][0], angVisible[i][0], escala, rel[0], rel[1]});
        rel =
            Transforma.transform(
                pos[1][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        lista.add(
            new Object[] {
              pjVisita, i, iteraciones[i][1], angVisible[i][1], escala, rel[0], rel[1]
            });
      }
      Object[] tmp1, tmp2;
      for (int i = 0; i < lista.size() - 1; i++) {
        for (int j = i + 1; j < lista.size(); j++) {
          tmp1 = lista.get(i);
          tmp2 = lista.get(j);
          if ((Integer) tmp1[6] > (Integer) tmp2[6]) {
            lista.set(i, tmp2);
            lista.set(j, tmp1);
          }
        }
      }

      for (Object obj[] : lista) {
        PintaJugador pj = (PintaJugador) obj[0];
        pj.pintaJugador(
            (Integer) obj[1],
            (Integer) obj[2],
            (Double) obj[3],
            (Double) obj[4],
            (Integer) obj[5],
            (Integer) obj[6],
            g);
      }

      for (int i = 0; i < 11; i++) {
        rel =
            Transforma.transform(
                pos[0][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        if (tipoTexto == 3 || (pos[0][i].distance(pos[2][0]) < 8 && tipoTexto == 1)) {
          pjLocal.pintaNumero(i, rel[0], rel[1], g);
        }
        if (tipoTexto == 4 || (pos[0][i].distance(pos[2][0]) < 8 && tipoTexto == 2)) {
          pjLocal.pintaNombre(i, rel[0], rel[1], g);
        }
        rel =
            Transforma.transform(
                pos[1][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        if (tipoTexto == 3 || (pos[1][i].distance(pos[2][0]) < 8 && tipoTexto == 1)) {
          pjVisita.pintaNumero(i, rel[0], rel[1], g);
        }
        if (tipoTexto == 4 || (pos[1][i].distance(pos[2][0]) < 8 && tipoTexto == 2)) {
          pjVisita.pintaNombre(i, rel[0], rel[1], g);
        }
      }
    } else {
      for (int i = 0; i < 11; i++) {
        rel =
            Transforma.transform(
                pos[0][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        pjLocal.pintaJugador(i, iteraciones[i][0], angVisible[i][0], escala, rel[0], rel[1], g);
        if (tipoTexto == 3 || (pos[0][i].distance(pos[2][0]) < 8 && tipoTexto == 1)) {
          pjLocal.pintaNumero(i, rel[0], rel[1], g);
        }
        if (tipoTexto == 4 || (pos[0][i].distance(pos[2][0]) < 8 && tipoTexto == 2)) {
          pjLocal.pintaNombre(i, rel[0], rel[1], g);
        }
        rel =
            Transforma.transform(
                pos[1][i],
                Constants.centroCampoJuego,
                -Transforma.transform(px, escala) + sx2,
                -Transforma.transform(py, escala) + sy2,
                escala);
        pjVisita.pintaJugador(i, iteraciones[i][1], angVisible[i][1], escala, rel[0], rel[1], g);
        if (tipoTexto == 3 || (pos[1][i].distance(pos[2][0]) < 8 && tipoTexto == 1)) {
          pjVisita.pintaNumero(i, rel[0], rel[1], g);
        }
        if (tipoTexto == 4 || (pos[1][i].distance(pos[2][0]) < 8 && tipoTexto == 2)) {
          pjVisita.pintaNombre(i, rel[0], rel[1], g);
        }
      }
    }

    rel =
        Transforma.transform(
            ball,
            Constants.centroCampoJuego,
            -Transforma.transform(px, escala) + sx2,
            -Transforma.transform(py, escala) + sy2,
            escala);
    if (partido.getAlturaBalon() > 2) {
      pb.pintaBalon((int) (giro), ang, escala, rel[0], rel[1], z * 2, g);
    }
    pc.pintaArcos(g, p, escala);
    if (estadio) {
      pc.pintaEstadio(g, p, escala);
    }
    if (marcador) {
      pm.pintaMarcador(
          partido.getGolesLocal(),
          partido.getGolesVisita(),
          partido.getIteracion(),
          partido.getPosesionBalonLocal(),
          g);
    }
    if (golIter > 0) {
      double zoom = 1 + 0.05 * (golIter % 3);
      g.drawImage(
          golImage.getScaledCopy((int) (361d * zoom), (int) (81d * zoom)),
          sx2 - (int) (180d * zoom),
          sy2 - (int) (40d * zoom));
    }

    if (offSideIter > 0) {
      g.drawImage(offSideImage, sx2 - 70, sy2 - 20);
      // g.drawImage(offSideImage, offSideIter - 300, sy2 - 20);
    }

    if (saqueIter > 0) {
      g.drawImage(cambioImage, saqueIter - 300, sy2 - 20);
    }
    if (autoescala) {
      escala = escalaTemporal;
    }
    if (guardado && iteracionControl > 0) {
      Image img = paImage;
      if (incremento > 0) {
        img = avImage;
      }
      if (incremento < 0) {
        img = reImage;
      }
      g.drawImage(img, sx2 - 10, sy2 - 10);
      g.setColor(Color.white);
      g.drawString("" + incremento + "x", sx2 + 20, sy2 - 10);
    }
    if (guardado && progreso) {
      g.setColor(Color.black);
      g.drawRect(sx - 20, 20, 10, sy - 40);
      g.setColor(Color.darkGray);
      g.fillRect(sx - 19, 21, 8, sy - 42);
      int valor =
          (int) (((double) sy - 41.0) * ((double) pg.getTiempo() / (double) pg.getIterciones()));
      int valorInicio =
          (int) (((double) sy - 42.0) * ((double) inicio / (double) pg.getIterciones()));
      int valorFin = (int) (((double) sy - 42.0) * ((double) fin / (double) pg.getIterciones()));
      g.setColor(Color.red);
      g.fillRect(sx - 19, sy - 21 - valor, 8, valor);
      g.setColor(Color.white);
      g.drawLine(sx - 19, sy - 22 - valorFin, sx - 12, sy - 22 - valorFin);
      g.drawLine(sx - 19, sy - 21 - valorFin, sx - 18, sy - 21 - valorFin);
      g.drawLine(sx - 13, sy - 21 - valorFin, sx - 12, sy - 21 - valorFin);
      g.drawLine(sx - 19, sy - 22 - valorInicio, sx - 12, sy - 22 - valorInicio);
      g.drawLine(sx - 19, sy - 23 - valorInicio, sx - 18, sy - 23 - valorInicio);
      g.drawLine(sx - 13, sy - 23 - valorInicio, sx - 12, sy - 23 - valorInicio);
    }
    if (showTexto) {
      if (partido.getIteracion() < 50) {
        g.setColor(Color.black);
        g.drawString(partido.getDetalleVisita().getTacticName() + " (Visita)", sx2 + 11, sy2 + 11);
        g.drawString("vs", sx2 + 41, sy2 + 41);
        g.drawString(partido.getDetalleLocal().getTacticName() + " (Local)", sx2 + 71, sy2 + 71);
        g.setColor(Color.white);
        g.drawString(partido.getDetalleVisita().getTacticName() + " (Visita)", sx2 + 10, sy2 + 10);
        g.drawString("vs", sx2 + 40, sy2 + 40);
        g.drawString(partido.getDetalleLocal().getTacticName() + " (Local)", sx2 + 70, sy2 + 70);
      }
    }
    if (showTexto) {
      if (partido.getIteracion() > Constants.ITERACIONES) {
        g.setColor(Color.black);
        g.drawString("Gana", sx2 + 11, sy2 + 11);
        if ((partido.getGolesLocal() > partido.getGolesVisita())
            || (partido.getGolesLocal() == partido.getGolesVisita()
                && partido.getPosesionBalonLocal() >= .5d)) {
          g.drawString(partido.getDetalleLocal().getTacticName(), sx2 + 41, sy2 + 41);
        } else {
          g.drawString(partido.getDetalleVisita().getTacticName(), sx2 + 41, sy2 + 41);
        }
        g.setColor(Color.white);
        g.drawString("Gana", sx2 + 10, sy2 + 10);
        if ((partido.getGolesLocal() > partido.getGolesVisita())
            || (partido.getGolesLocal() == partido.getGolesVisita()
                && partido.getPosesionBalonLocal() >= .5d)) {
          g.drawString(partido.getDetalleLocal().getTacticName(), sx2 + 40, sy2 + 40);
        } else {
          g.drawString(partido.getDetalleVisita().getTacticName(), sx2 + 40, sy2 + 40);
        }
      }
    }
    /*if (isRain) {
        g.setColor(lluvia);
        for (int i = 0; i < 200; i++) {
            double an = rand.nextDouble() * Math.PI * 2d;
            double rad = rand.nextDouble() * 1024;
            int x0 = (int) (sx2 + Math.sin(an) * rad);
            int y0 = (int) (sy2 + Math.cos(an) * rad);
            int x1 = (int) (sx2 + Math.sin(an) * rad * 1.1d);
            int y1 = (int) (sy2 + Math.cos(an) * rad * 1.1d);
            g.drawLine(x0, y0, x1, y1);
        }
        if (rand.nextDouble() < 0.05) {
            g.setColor(relampago);
            g.fillRect(0, 0, sx, sy);
        }
        isRain = rand.nextDouble() < 0.995;
    } else {
        isRain = rand.nextDouble() < 0.005;
    }*/
  }
Ejemplo n.º 23
0
 @Override
 public void draw(Graphics graphics) {
   graphics.drawRect(getX() * Game.GAME_TILE_SIZE, getY() * Game.GAME_TILE_SIZE, 16, 16);
 }
Ejemplo n.º 24
0
  // This method draws when player is still
  public void drawMovingNoPlayerMov(int x_tile_dist, int y_tile_dist, Graphics g) {
    // System.out.println(getMoving());
    // System.out.println(inputDelta);

    float part = (float) getInputDelta() / (float) getSpeed();
    int offset = (int) (part * Map.SIZE_OF_TILE);

    // System.out.println(part);
    // System.out.println(offset);

    int x_move = ((Player.getPlayerXCenter() + x_tile_dist) * Map.SIZE_OF_TILE) + Map.X_OFFSET;
    int y_move = ((Player.getPlayerYCenter() + y_tile_dist) * Map.SIZE_OF_TILE) + Map.Y_OFFSET;

    int tile = Map.SIZE_OF_TILE;

    int actual_x = 0;
    int actual_y = 0;
    switch (getMoving()) {
      case 1:
        // anim.draw(x_move+tile-offset, y_move+offset-tile);
        actual_x = x_move + tile - offset;
        actual_y = y_move + offset - tile;
        break;
      case 2:
        // anim.draw(x_move, y_move+offset-tile);
        actual_x = x_move;
        actual_y = y_move + offset - tile;
        break;
      case 3:
        // anim.draw(x_move-tile+offset, y_move+offset-tile);
        actual_x = x_move - tile + offset;
        actual_y = y_move + offset - tile;
        break;
      case 4:
        // anim.draw(x_move+tile-offset, y_move);
        actual_x = x_move + tile - offset;
        actual_y = y_move;
        break;
      case 6:
        // anim.draw(x_move-tile+offset, y_move);
        actual_x = x_move - tile + offset;
        actual_y = y_move;
        break;
      case 7:
        // anim.draw(x_move+tile-offset, y_move+tile-offset);
        actual_x = x_move + tile - offset;
        actual_y = y_move + tile - offset;
        break;
      case 8:
        // anim.draw(x_move, y_move+tile-offset);
        actual_x = x_move;
        actual_y = y_move + tile - offset;
        break;
      case 9:
        // anim.draw(x_move-tile+offset, y_move+tile-offset);
        actual_x = x_move - tile + offset;
        actual_y = y_move + tile - offset;
        break;
    }

    anim.draw(actual_x, actual_y);

    if (attacked) {
      g.setColor(RED);
      g.drawRect(actual_x, actual_y, Map.SIZE_OF_TILE, Map.SIZE_OF_TILE);
      g.setColor(BLACK);
    }

    getStatus().drawMoveMonster(actual_x, actual_y);
  }