我正在 andengine 中开发一个问答游戏,其中有一个问题和答案正在跳动 但问题是游戏运行正常,但是当使用肖像方向时,我的游戏问题超出了相机范围,因此一半问题只能可读
如何设置文本以适合相机宽度
mBitmapFont=FontFactory.createFromAsset(this.getFontManager(),this.getTextureManager(),
200, 222, TextureOptions.BILINEAR,this.getAssets(), "Plok.ttf", 32, true, Color.WHITE);
question = new Text(10, 45, mBitmapFont, getString(R.string.question1), getVertexBufferObjectManager());
最佳答案
您可以缩放文本
if (question.getWidth() > CAMERA_WIDTH) {
question.setScale(1/(question.getWidth()/CAMERA_WIDTH));
}
或文本中的“\n”表示换行符。
关于java - 文字超出相机范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16870148/