示例#1
0
 public void render(GameContainer gc, Graphics g) {
   sprite.draw(x, y);
   if (lines.size() > 0) {
     font.drawString(xLine1, yLine1, lines.get(0));
   }
   if (lines.size() > 1) {
     font.drawString(xLine2, yLine2, lines.get(1));
   }
 }
示例#2
0
 public float getYOffset() {
   if (font == null) return 0;
   if (yoffsetDirty) {
     yoffset = font.getYOffset(text);
     yoffsetDirty = false;
   }
   return yoffset;
 }
示例#3
0
 public float getHeight() {
   if (font == null) return 0;
   if (heightDirty) {
     height = font.getHeight(text);
     heightDirty = true;
   }
   return height;
 }
示例#4
0
  public void render() {
    PerformanceMonitor.startActivity("Render UIText");

    ShaderManager.getInstance().enableDefaultTextured();

    // TODO HACK: Workaround because the internal Slick texture mechanism is never used
    _workaroundTexture.bind();

    if (_shadowed) _font.drawString(_shadowOffset.x, _shadowOffset.y, _text, _shadowColor);

    _font.drawString(0, 0, _text, _color);

    // TODO: Also ugly..
    glDisable(GL11.GL_TEXTURE_2D);

    PerformanceMonitor.endActivity();
  }
示例#5
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);
  }
示例#6
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");
  }
示例#7
0
 public int getTextWidth() {
   return _font.getWidth(_text);
 }
示例#8
0
 public int getTextHeight() {
   return _font.getHeight(_text);
 }
示例#9
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   // TODO Auto-generated method stub
   font.drawString(250, 280, "Thank you for playing!!!");
 }