Ejemplo n.º 1
0
  public void render() {
    text = "" + StaticManager.getScore();
    if (hasFocusEffect() && hasFocus()) {
      getFocusColor().bind();
    } else {
      getNormalColor().bind();
    }
    int xoff = 0;
    System.out.println("SCORE:" + text + "/" + StaticManager.getScore());
    for (int i = 0; i < text.length(); i++) {
      String subs = text.substring(i, i + 1);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, font[getIndex(subs)].getTextureID());
      GL11.glBegin(GL11.GL_QUADS);
      GL11.glTexCoord2f(0.0f, 0.0f);
      GL11.glVertex2i(getX() + xoff, getY());

      GL11.glTexCoord2f(1.0f, 0.0f);
      GL11.glVertex2i(getX() + xoff + font[getIndex(subs)].getImageWidth(), getY());

      GL11.glTexCoord2f(1.0f, 1.0f);
      GL11.glVertex2i(
          getX() + xoff + font[getIndex(subs)].getImageWidth(),
          getY() + font[getIndex(subs)].getImageHeight());

      GL11.glTexCoord2f(0.0f, 1.0f);
      GL11.glVertex2i(getX() + xoff, getY() + font[getIndex(subs)].getImageHeight());
      GL11.glEnd();
      xoff += font[getIndex(subs)].getImageWidth();
    }
  }
Ejemplo n.º 2
0
  public void select() {
    text = "" + StaticManager.getScore();
    System.out.println("selecting: " + getId());
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Color c = new Color(getId(), 255, 255, 255);
    c.bind();
    int xoff = 0;
    for (int i = 0; i < text.length(); i++) {
      String subs = text.substring(i, i + 1);
      GL11.glBegin(GL11.GL_QUADS);
      GL11.glVertex2i(getX() + xoff, getY());

      GL11.glVertex2i(getX() + xoff + font[getIndex(subs)].getImageWidth(), getY());

      GL11.glVertex2i(
          getX() + xoff + font[getIndex(subs)].getImageWidth(),
          getY() + font[getIndex(subs)].getImageHeight());

      GL11.glVertex2i(getX() + xoff, getY() + font[getIndex(subs)].getImageHeight());
      GL11.glEnd();
      xoff += font[getIndex(subs)].getImageWidth();
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }