wator 시뮬레이션은 물고기를 먹는 상어였습니다. 무작위로 상어를 산다면, 프로그램이 컴파일되지만 "Vertical Sync is not supported"가 나타납니다.SFML Vertical Sync가 지원되지 않습니다.
우분투에서 작업하기 16.04. 전에 다른 일을하고 있었는데 같은 오류가 발생했지만 창은 표시되지 않았습니다. 어떤 도움이 필요합니까?
편집 내가 내 루프에서 너무 많은 일 {
있었지만 지금은 무엇입니까 코드까지 해결 한 오류가 난 8 비트하지만 didnt 한 도움말을 내 PNG을 변경 한 "분할 오류 (코어 덤프)".
#include <SFML/Graphics.hpp>
int main()
{
int n;
int x;
int y;
sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
// Set Frame Rate to 60fps
window.setFramerateLimit(60);
srand(time(0));
sf::Texture shark;
shark.loadFromFile("image.png");
std::vector<sf::Sprite> Fishes(n,sf::Sprite(shark));
for (int n = 0; n < Fishes.size(); n++){
Fishes[n].setOrigin(15, 15);
Fishes[n].getPosition();
Fishes[n].setPosition(x = rand() % 790 + 10, y = rand() % -10 - 50);
}
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
Fishes[n].setPosition(x, y+=1);
Fishes[n].rotate(1);
// clear the window with black color
window.clear(sf::Color::Black);
// draw everything here...
// window.draw(...);
window.draw(Fishes[n]);
// end the current frame
window.display();
}
return 0;
}
루프 변수는 'i'이지만 전역 변수 인'n'을 사용합니다. 이 'n'을 다시 사용하여 렌더링에서 완벽한 루프가 누락되었습니다. 나는 당신이 당신의 논리를 곧바로 이해해야한다고 말하고 싶습니다. 좋은 생각은 전역을 전혀 none으로 제한하는 것입니다. v-sync는 아마도 경고 일 뿐이며 일단 프로그램을 수정하면 프로그램이 잘 작동합니다. – nvoigt
나는 그것을 가지고있어 ... 나는'{'너무 많은 것을 가지고있다 –
나는 새로운 오류 –