简体   繁体   English

Allegro5:将int放到屏幕上

[英]Allegro5: putting int's onto the screen

for example: 例如:

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;

}

Is this possible, or how about converting the score to a const char or a string ? 这可能吗,或者将分数转换为const charstring呢?

You can use al_draw_textf to print a string using a printf-style format string. 您可以使用al_draw_textf使用printf样式的格式字符串来打印字符串。

Something like this: 像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM