2016-07-05 1 views
0

그래서 나는이 오류가 무엇입니까 : game.cpp(15): error C3867: 'sf::Window::isOpen': non-standard syntax; use '&' to create a pointer to memberSFML 오류 - isOpen 비표준 구문입니다.

Game.cpp

#include "Game.h" 
#include <SFML/Graphics.hpp> 
#include <SFML/Window.hpp> 

Game::Game() : 
    window(sf::VideoMode(200, 200), "SFML works!"), 
    player() 
{ 
    player.setRadius(40.f); 
    player.setPosition(100.f, 100.f); 
    player.setFillColor(sf::Color::Cyan); 
} 

void Game::run() { 
    while (window.isOpen) { 
     processEvents(); 
     update(); 
     render(); 
    } 
} 

void Game::processEvents() 
{ 
    sf::Event event; 
    while (window.pollEvent(event)) { 
     if (event.type == sf::Event::Closed) 
      window.close(); 
    } 
} 

void Game::update() { 

} 

void Game::render() { 
    window.clear(); 
    window.draw(player); 
    window.display(); 
} 

을 그리고 이것이 내가 내가 뭘 잘못 아무 생각이 내 game.h

#include <SFML/Graphics.hpp> 
#include <SFML/Window.hpp> 

class Game { 
public:       
    Game();   
    void run(); 
    sf::RenderWindow window; 
    sf::CircleShape player; 
private:   
    void processEvents();   
    void update();   
    void render(); 
}; 

, 나는 보았다 여물통 stackoverflow 같은 오류에 대한 답변을하지만 그들은 모두 일반적이고 그들은 SFML 라이브러리에서 나 때문에이 오류를 해결하는 데 도움이되지 않습니다. 누군가가 그것을 해결하는 방법을 알고 있다면 도와주세요 :)

+4

'while (window.isOpen)'을'while (window.isOpen()) '으로 변경하십시오. –

+0

농담하는 것이 좋습니다 ... 진지하게 간과 했습니까? – Martacus

답변

2

여기 while (window.isOpen) 이 아닌 멤버 함수 포인터 'window.isOpen'이 테스트 중입니다. 의도 한 바는 while (window.isOpen())으로 전화하십시오.