本文整理汇总了Java中org.andengine.entity.text.Text.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Text.getWidth方法的具体用法?Java Text.getWidth怎么用?Java Text.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.text.Text
的用法示例。
在下文中一共展示了Text.getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextRectangle
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public Rectangle createTextRectangle(String titleStr, Font titleFont, String detatilStr, Font detailFont,
VertexBufferObjectManager pVertexBufferObjectManager) {
Text titleText = new Text(0, 0, titleFont, titleStr,
pVertexBufferObjectManager);
Text detatilText = new Text(0, 0, detailFont, detatilStr,
pVertexBufferObjectManager);
titleText.setPosition(0, 0);
detatilText.setPosition(titleText.getX() + titleText.getWidth(), titleText.getY());
float textWidth = titleText.getWidth() + detatilText.getWidth();
float textHeight = titleText.getHeight();
Rectangle resultRectangle = new Rectangle(0, 0, textWidth, textHeight,
pVertexBufferObjectManager);
resultRectangle.setColor(Color.TRANSPARENT);
resultRectangle.setAlpha(0.0f);
resultRectangle.attachChild(titleText);
resultRectangle.attachChild(detatilText);
return resultRectangle;
}
示例2: TextButton
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public TextButton(List<TextButtonState> textButtonStateList, Text pText, float pX, float pY, float pAddWidth, float pAddHeight,
VertexBufferObjectManager pVertexBufferObjectManager, final OnClickListener pOnClickListener) {
super(pX, pY, pText.getWidth() + pAddWidth, pText.getHeight() + pAddHeight, pVertexBufferObjectManager);
this.setColor(Color.BLACK);
this.setAlpha(0.8f);
this.mOnClickListener = pOnClickListener;
this.mButtonText = pText;
this.mButtonText.setPosition(pAddWidth / 2, pAddHeight / 2);
attachChild(mButtonText);
this.mStateList = textButtonStateList;
this.changeState(getButtonState(State.NORMAL));
}