开发者

Change text on shape

Hi is it possible to change the text of a shape? I have:

levelFraction = new Text(0, 300, mFont, "text", HorizontalAlign.CENTER);

then I add it to the scene:

scene.getTopLayer().addEntity(levelFraction);

but I don't see a开发者_如何学运维ny method to change the text at runtime. Something like:

levelFraction.setText(...);

Is that possible?


if Sheet1.shapes(0).texteffect.text="Go" then
   sheet1.shapes(0).texteffect.text="Stop"
else
   sheet1.shapes(0).texteffect.text="Go"
end if

You could even call a sub based on the the value of the texteffect.text


I don't know anything about the AndEngine library, so this would just be a wild guess:

Could you perhaps use the ChangeableText (which extends Text) instead of Text? From the name it sounds like you should be able to change the text, and looking at the code it also have a couple of functions to set the text: ChangeableText source


font_texture_golbalValue = new Texture(128,64,TextureOptions.BILINEAR);
font4 = new Font(font_texture_golbalValue, Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD), textSize, true, Color.WHITE);
this.mEngine.getTextureManager().loadTexture(this.font_texture_golbalValue);
this.mEngine.getFontManager().loadFont(this.font4);
scoreval=new ChangeableText(24*CAMERA_WIDTH/100, score_postion, this.font2, ""+scoreValue,"Score##".length());

and You can use scorevalue.SetText();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜