Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.BitmapFont.draw()


      int numGlyphs = font.computeVisibleGlyphs(string, 0, string.length(), availableWidth);
      bounds.set(font.getBounds(string));
      height -= background.getBottomHeight() + background.getTopHeight();
      float textY = (int)(height / 2 + background.getBottomHeight() + bounds.height / 2);
      font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
      font.draw(batch, string, x + background.getLeftWidth(), y + textY, 0, numGlyphs);
    }
  }

  /** Get the set of selected items, useful when multiple items are selected
   * @return a Selection object containing the selected elements */
 
View Full Code Here


        boolean selected = selection.contains(item);
        if (selected) {
          selectedDrawable.draw(batch, x, y + itemY - itemHeight, width, itemHeight);
          font.setColor(fontColorSelected.r, fontColorSelected.g, fontColorSelected.b, fontColorSelected.a * parentAlpha);
        }
        font.draw(batch, item.toString(), x + textOffsetX, y + itemY - textOffsetY);
        if (selected) {
          font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a
            * parentAlpha);
        }
      } else if (itemY < cullingArea.y) {
View Full Code Here

          font.setColor(style.messageFontColor.r, style.messageFontColor.g, style.messageFontColor.b,
            style.messageFontColor.a * parentAlpha);
        } else
          font.setColor(0.7f, 0.7f, 0.7f, parentAlpha);
        BitmapFont messageFont = style.messageFont != null ? style.messageFont : font;
        messageFont.draw(batch, messageText, x + bgLeftWidth, y + textY + yOffset);
      }
    } else {
      font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
      drawText(batch, font, x + bgLeftWidth, y + textY + yOffset);
    }
View Full Code Here

        (itemY - itemHeight <= cullingArea.y + cullingArea.height && itemY >= cullingArea.y)) {
        if (selected == i) {
          selectedPatch.draw(batch, x, y + itemY - itemHeight, Math.max(prefWidth, width), itemHeight);
          font.setColor(fontColorSelected.r, fontColorSelected.g, fontColorSelected.b, fontColorSelected.a * parentAlpha);
        }
        font.draw(batch, items[i], x + textOffsetX, y + itemY - textOffsetY);
        if (selected == i) {
          font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a
            * parentAlpha);
        }
      } else if (itemY < cullingArea.y) {
View Full Code Here

      float availableWidth = width - background.getLeftWidth() - background.getRightWidth();
      int numGlyphs = font.computeVisibleGlyphs(items[selection], 0, items[selection].length(), availableWidth);
      bounds.set(font.getBounds(items[selection]));
      float textY = (int)(height / 2) + (int)(bounds.height / 2);
      font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
      font.draw(batch, items[selection], x + background.getLeftWidth(), y + textY, 0, numGlyphs);
    }

    // calculate screen coords where list should be displayed
    ScissorStack.toWindowCoordinates(stage.getCamera(), batch.getTransformMatrix(), screenCoords.set(x, y));
  }
View Full Code Here

        if (selected == i) {
          listSelection.draw(batch, x, y + posY - itemHeight, width, itemHeight);
        }
        font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
        font.setScale(SelectBox.this.parent.scaleX, SelectBox.this.parent.scaleY);
        font.draw(batch, items[i], x + textOffsetX, y + posY - textOffsetY);
        font.setScale(1, 1);
        posY -= itemHeight;
      }
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.