嘿,所以我试图从文件中读取内容,基本上是创建一个很酷的星图。我完全是个新手,这是我第一次玩SFML。我正在CLion上工作。
我已经使用了调试器,可以看到所有内容都已正确放置在适当的位置,但是当我运行该程序时,Window最终冻结了,什么也没画。我不确定是我的循环是问题还是其他因素。我认为我不需要使用向量,因为Vector2f似乎就足够了……任何帮助都将不胜感激!!!
CircleShape star;
star.setRadius(2);
while(!fileIn.eof()){
fileIn >> xPixel >> yPixel >> brightStar;
star.setPosition( Vector2f(xPixel, yPixel) );
window.draw(star);
}
fileIn.close();
绘图窗口只是死了,并且没有响应”
哦,现在我把它放在...
CircleShape star;
star.setRadius(2);
while(!fileIn.eof()){
fileIn >> xPixel >> yPixel >> brightStar;
star.setPosition( Vector2f(xPixel, yPixel) );
window.draw(star);
CircleShape star;
star.setRadius(2);
}
fileIn.close();
星空图显示一秒钟然后消失了
同意呀:
CircleShape star;
star.setRadius(2);
while(!fileIn.eof()){
{
fileIn >> xPixel >> yPixel >> brightStar;
star.setPosition( Vector2f(xPixel, yPixel) );
window.draw(star);
CircleShape star;
star.setRadius(2);}
window.display();
}
fileIn.close();