안녕하세요. 공이 렌더링 윈도우에서 튀어 오르는 프로그램을 설정하려고합니다. 나는 SFML C++, iostream, codeblocks (차이가 나는 경우)를 사용하고 있습니다. 나는 내가 거의 완성 단계에 이르지 못했고 나는 잘못된 방향으로 가고 있을지도 모른다는 것을 안다. 그러나 내가 확실히 알고있는 한 가지는 내 프로그램이 작동하도록 sf :: Window :: setFramerateLimit (60);을 구현해야하거나 적어도 내 코드에있는 것입니다.C++ SFML 코드 블록에서 setFramerate 할 때 오류가 발생했습니다.
include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;
using namespace sf;
int main(){
RenderWindow window(sf::VideoMode(1500,800), "Bouncing Circle");
sf::Window::setFramerateLimit(60);
내가 빌드하려고 적/내 프로그램을 실행 나는 오류 얻을 때 :
오류 : 개체없이 멤버 함수 '무효 김포 :: 창 :: setFramerateLimit (부호없는 int)를'호출 할 수 없습니다 |를 당신이 sf::Window::setFramerateLimit(60);
이
#include<iostream>
#include<SFML/Graphics.hpp>
#include<stdlib.h>
#include<time.h>
using namespace std;
using namespace sf;
int main(){
RenderWindow window(sf::VideoMode(1500,800), "Bouncing Circle");
sf::Window::setFramerateLimit(60);
srand(time(NULL));
int Rand1 = rand()%1500+1;
int Rand2 = rand()%800+1;
int x;
int y;
int BREAK = 1;
sf::CircleShape MyCircle(50);
MyCircle.setPosition(1,1);
MyCircle.setFillColor(sf::Color(500,0,0));
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event));
{
if(event.type == sf::Event::Closed)
window.close();
}
x = 1;
y = 1;
for(int ii = 0; ii < 675; ii++){
x++;
y++;
MyCircle.setPosition(x, y);
window.draw(MyCircle);
window.display();
window.clear();
BREAK++;
if(BREAK == 675){
break;
}
}
}
return 0;
}
문제에 대한 빠른 해결책을 원한다면 학교 마감일과 같이 문제 자체와 관련이없는 모든 것을 삭제하십시오. 독자의주의를 산만하게합니다. – arboreal84