예제 #1
0
 private void resetGlyphLayoutAmmounts(String s) {
   ammountsText.setText(s, optionsBounds.getX(), optionsBounds.getY(), optionsBounds.getWidth());
 }
예제 #2
0
  public ShopStateGold(ShopState parent) {
    //		this.parent = parent;
    goldTexture = new Texture("Gold256x128.png");
    goldSprite = new Sprite(goldTexture);
    goldBatch = new SpriteBatch();
    currencyText =
        new CenteredText(StaticBitmapFont.getBitmapFont(), StaticBitmapFont.getSpriteBatch());
    titleText =
        new CenteredText(StaticBitmapFont.getBitmapFont(), StaticBitmapFont.getSpriteBatch());
    ammountsText =
        new RightText(StaticBitmapFont.getBitmapFont(), StaticBitmapFont.getSpriteBatch());
    pricesText = new LeftText(StaticBitmapFont.getBitmapFont(), StaticBitmapFont.getSpriteBatch());

    float w = FastClicker.WIDTH / 7;
    buttonChangeCurrency =
        new ButtonSquare(w, w * 3, w * 5, w, RectangleRenderer.getWHITE_PIXEL(), "My currency");

    float marginY = FastClicker.HEIGHT / 20;
    float marginX = FastClicker.WIDTH / 20;

    float titleTextX = 0;
    float titleTextW = FastClicker.WIDTH;
    float titleTextY = FastClicker.HEIGHT - marginY;
    titleText.setText("Get tons of gold\nin a short time.", titleTextX, titleTextY, titleTextW);

    int arrowW = FastClicker.WIDTH / 4;
    int arrowH = arrowW;
    int arrowX = (int) ((FastClicker.WIDTH - arrowW) / 2);
    int arrowY = (int) (titleTextY - titleText.getHeight() - arrowH - marginY);
    arrowsColumn = new ArrowsColumn(arrowX, arrowY, arrowW, arrowH, 1);

    int goldSpriteW = FastClicker.WIDTH - arrowX - arrowW;
    int goldSpriteH = arrowW;
    int goldSpriteX = arrowX + arrowW;
    int goldSpriteY = arrowY;
    goldSprite.setBounds(goldSpriteX, goldSpriteY, goldSpriteW, goldSpriteH);

    float currencyX = marginX;
    float currencyY = goldSpriteY;
    float currencyW = arrowX;
    float currencyH = goldSpriteH;
    currencyBounds = new Rectanglef(currencyX, currencyY, currencyW, currencyH);

    float optionsAreaX = marginX;
    float optionsAreaY = arrowY - marginY;
    float optionsAreaW = FastClicker.WIDTH - 2 * marginX;
    optionsBounds = new TextBounds(optionsAreaX, optionsAreaY, optionsAreaW);

    setCurrency("EUR", 1);

    lineH = StaticBitmapFont.getBitmapFont().getLineHeight();
    optionSelector =
        new CellSelector(
            FastClicker.WIDTH,
            StaticBitmapFont.getBitmapFont().getLineHeight(),
            0,
            optionsBounds.getY() - lineH * price.length);
    float extraOutline = marginX / 4;
    selectionBounds =
        new Rectanglef(
            optionsBounds.getX() - extraOutline,
            optionsBounds.getY() - lineH * (price.length - 0.25f),
            optionsBounds.getWidth() + extraOutline * 2,
            lineH);
  }
예제 #3
0
 private void resetGlyphLayoutPrices(String s) {
   pricesText.setText(s, optionsBounds.getX(), optionsBounds.getY(), optionsBounds.getWidth());
 }