c ++ sfml数组[5]在for循环window.display中的字符串,只显示行1,3,5 [英] c++ sfml array[5] of strings in for loop window.display, only showing line 1,3,5

查看:145
本文介绍了c ++ sfml数组[5]在for循环window.display中的字符串,只显示行1,3,5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我不能正确地解释自己,你将不得不原谅我,我试图使用c ++ sfml字符串数组创建一个highscore表。我尝试使用 window.draw(array [1],array [2] 等等)分别绘制它们。

You will have to forgive me if I can't explain myself properly, I am trying to create a highscore table using c++ sfml string array. I tried drawing them separately using window.draw(array[1],array[2] and so on.

但是如果我把数组放在一个for循环并使用一个int变量,它只绘制数组1,3和5。

But if I put the array in a for loop and use an int variable, it only draws array 1, 3 and 5.

for(cnt = 0;cnt <5;cnt++)
    {
        thiswindow.draw(topscores[cnt]);
        thiswindow.draw(topnames[cnt]);
        thiswindow.display();
    }


推荐答案

将显示器从循环中取出,这应该可以解决问题。

Take the display out of the loop. This should fix the problem.

这篇关于c ++ sfml数组[5]在for循环window.display中的字符串,只显示行1,3,5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆