@Override public void draw(Canvas canvas) { canvas.drawBitmap(background, getX(), getY(), null); Utils.drawText( (int) (getX() + background.getWidth() / 2 - fw / 2), (int) (getY() + background.getHeight() / 2), "" + level, paintText, canvas, 255, 255, 255); int xp = (int) (getX() - background.getWidth() / 2); int yp = (int) (getY() + background.getHeight() / 2); int wstr = Factory.get().miniStar.getWidth() + 2 * 3; int gapw = (background.getWidth() / 2 - wstr / 2) / 2; for (int i = 0; i < 3; i++) { if (i < estrelas) { canvas.drawBitmap(Factory.get().miniStar, getX() + gapw, yp + 9, null); } else { canvas.drawBitmap(Factory.get().miniStarDvt, getX() + gapw, yp + 9, null); } gapw += Factory.get().miniStar.getWidth() + 2; } // canvas.drawText(""+level, getX()+background.getWidth()/2, // getY()+background.getHeight()/2, paintText); }
public LevelSelector(int level) { super("SceneObject", "LevelSelector"); background = Factory.get().escolhaFase; paintText.setColor(Color.WHITE); paintText.setTypeface(Factory.get().systemFont); paintText.setTextSize(28); paintText.setAntiAlias(true); this.level = level; estrelas = Engine.get().database.getLevelStars(level); // Log.i(Engine.TAG, "level: " + level + " ESTRELAS:" + estrelas); }