Allegro5:把int放到屏幕上

时间:2013-10-15 16:29:34

标签: c++ text fonts allegro5

例如:

int score = 20;

int main(){
    al_draw_text(foo, foo, foo, foo, foo, "SCORE");

    //I would then like to print the score to the screen,
    // is there anyway to do this?   


   al_rest(1000);

   return 0;

}

这可能,或者如何将分数转换为const charstring

1 个答案:

答案 0 :(得分:0)

您可以使用al_draw_textf使用printf样式的格式字符串打印字符串。

这样的事情:

al_draw_textf(my_font, my_color, x_pos, y_pos, 0, "score = %d", score);