我使用的是发动机GLES1。我希望在我的节目中显示时间但是时间没有显示。
TimerHandler mTimerHandler = new TimerHandler(0.1f, true, new ITimerCallback() {
public void onTimePassed(TimerHandler pTimerHandler) {
Scene scene = SG3Activity.this.mEngine.getScene();
TIME_REMAINING --;
final ChangeableText Text = new ChangeableText(34, 35, mFont, "time:"+TIME_REMAINING);
scene.getFirstChild().attachChild(Text);
}
});
答案 0 :(得分:1)
Text record = new Text(0, 0, gScene.mFont, ""+ recordScore, 50, new TextOptions(HorizontalAlign.CENTER), gameActivity.getVertexBufferObjectManager());
record.setPosition(scoreBoardSprite.getWidth() * 0.7f, scoreBoardSprite.getHeight()* 0.35f);
record.setColor(235.0f/255.0f, 70.0f/255.0f, 7.0f/255.0f, 1);
scoreBoardSprite.attachChild(record);
TimerHandler timerHandler = new TimerHandler(0.1f, true,new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
if(counter < gameScore){
counter++;
record.setText(""+counter);
}else{
unregisterUpdateHandler(pTimerHandler);
}
}
});
registerUpdateHandler(timerHandler);
}
这里我正在创建文本并更新计时器中的文本&#34; setText()&#34;方法