예제 #1
0
  @Override
  public void render(EntityPlayer player, Graphics g, double x, double y) {
    final float pitch = player.pitch;

    final int attackTime = player.getAttackTime();

    final boolean flip = pitch >= 90 && pitch <= 270;
    final Renderable sprite = this.getSprite(player, attackTime);

    final float width = 12;
    final float height = 24;

    GL11.glPushMatrix();

    GL11.glTranslated(x, y, 0);

    if (flip) {
      GL11.glScalef(-1, 1, 1);
    }

    GL11.glTranslatef(-width / 2, -height, 0);

    sprite.draw(0, 0);

    this.drawHeldItem(player, attackTime);

    GL11.glPopMatrix();
  }
예제 #2
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    ((Graphics2D) g).setBackground(Color.BLACK);
    for (Renderable e : RenderableHolder.getInstance().getRenderableList()) {
      if (e.isVisible() && e.getZ() < -1) e.draw((Graphics2D) g);
    }
    for (Monster m : Cage.getInstance().getCage()) {
      if (m.isVisible()) {
        m.draw((Graphics2D) g);
      }
    }
    for (Renderable e : RenderableHolder.getInstance().getRenderableList()) {
      if (e.isVisible() && e.getZ() >= -1) e.draw((Graphics2D) g);
    }
  }
예제 #3
0
  @Override
  public void onDrawFrame(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    camera.update(gl);
    camera.focusOnObjects(gl);

    for (Renderable r : renderScheduler.getRenderList(gl)) {
      gl.glPushMatrix();
      r.draw(gl);
      gl.glPopMatrix();
    }
  }