예제 #1
0
  /**
   * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.Graphics)
   */
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    g.scale(2, 2);
    g.fillRect(0, 0, 800, 600, back, 0, 0);
    g.resetTransform();

    g.drawImage(image, 100, 100);
    image.draw(100, 200, 80, 200);

    font.drawString(100, 200, "Text Drawn before the callable");

    SlickCallable callable =
        new SlickCallable() {
          @Override
          protected void performGLOperations() throws SlickException {
            renderGL();
          }
        };
    callable.call();

    homer.draw(450, 250, 80, 200);
    font.drawString(150, 300, "Text Drawn after the callable");
  }
예제 #2
0
  /**
   * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
   */
  public final void render(GameContainer container, Graphics g) throws SlickException {
    int yoffset = 0;
    int xoffset = 0;

    if (targetHeight < container.getHeight()) {
      yoffset = (container.getHeight() - targetHeight) / 2;
    }
    if (targetWidth < container.getWidth()) {
      xoffset = (container.getWidth() - targetWidth) / 2;
    }

    SlickCallable.enterSafeBlock();
    g.setClip(xoffset, yoffset, targetWidth, targetHeight);
    GL.glTranslatef(xoffset, yoffset, 0);
    g.scale(targetWidth / normalWidth, targetHeight / normalHeight);
    GL.glPushMatrix();
    held.render(container, g);
    GL.glPopMatrix();
    g.clearClip();
    SlickCallable.leaveSafeBlock();

    renderOverlay(container, g);
  }