Exemplo n.º 1
0
 public void draw(Graphics2D g2d, Block wall, Block floor, int mult) {
   for (int i = 4; i < (size + 2) * 2; i++) {
     for (int j = 4; j < (size + 2) * 2; j++) {
       floor.draw(g2d, i * 16 * mult, j * 16 * mult, mult);
     }
   }
   for (int i = 1; i <= width; i++) {
     for (int j = 1; j <= height; j++) {
       wall.draw(g2d, i * size * mult, j * size * mult, mult);
       if (south[i][j]) {
         drawLine(g2d, (i * size), (j * size), ((i + 1) * size), (j * size), mult, wall);
       }
       if (north[i][j]) {
         drawLine(g2d, i * size, (j + 1) * size, (i + 1) * size, (j + 1) * size, mult, wall);
       }
       if (west[i][j]) {
         drawLine(g2d, i * size, j * size, i * size, (j + 1) * size, mult, wall);
       }
       if (east[i][j]) {
         drawLine(g2d, (i + 1) * size, j * size, (i + 1) * size, (j + 1) * size, mult, wall);
       }
       if (treasure[i][j]) {
         g2d.setColor(Color.yellow);
         // g2d.fillRect(i * size + 1, j * size + 1, 16 - 1, 16 - 1);
       }
     }
   }
 }
Exemplo n.º 2
0
 private void drawLine(
     Graphics2D g2d, int startx, int starty, int endx, int endy, int mult, Block wall) {
   for (int i = startx; i < endx; i += 16) {
     wall.draw(g2d, i * mult, starty * mult, mult);
   }
   for (int j = starty; j < endy; j += 16) {
     wall.draw(g2d, startx * mult, j * mult, mult);
   }
 }
Exemplo n.º 3
0
  public void render() {
    glPushMatrix();
    {
      RenderUtils.setColor(Color.DARK_GRAY);
      glBegin(GL_QUADS);
      {
        float w = (float) width / (float) 2;
        glVertex3f(-w, 0f, w);
        glVertex3f(-w, 0f, -w);
        glVertex3f(w, 0f, -w);
        glVertex3f(w, 0f, w);
      }
      glEnd();
    }
    glPopMatrix();

    for (Block e : blocks) {
      e.render();
    }
  }