예제 #1
0
 private void initScoreboard(Context context) {
   scoreB.setTextContext(Typeface.create("Helvetica", Typeface.BOLD), 20, 0xff, 0xff, 0xff, 0xff);
   for (int i = 0; i < scoreHandles.length - 1; i++) {
     scoreHandles[i] = scoreB.setTextTexture(context, i + "");
   }
   scoreHandles[10] = scoreB.setTextTexture(context, "Score: ");
 }
예제 #2
0
  public void draw(float[] mMVPmatrix) {
    float x = -0.7f, y = 0.9f;
    int score = scorePts;

    scoreB.scaleDim(2f, 1f);
    scoreB.useTexture(scoreHandles[10]);
    scoreB.setPosition(x, y);
    scoreB.draw(mMVPmatrix);
    x = x + 0.25f;
    while (score >= 1) {
      score = score / 10;
      x += 0.05f;
    }

    score = scorePts;

    while (score >= 1) {
      int digit = score % 10;
      score = score / 10;
      scoreB.useTexture(scoreHandles[digit]);
      scoreB.setPosition(x, y);
      scoreB.draw(mMVPmatrix);
      x -= 0.05f;
    }
  }