简单简短:第4行有什么问题?我不能用相同类的0个参数来调用void。
#include "Game.h"
Game::Game(int width, int height, std::string title) {
sf::RenderWindow* window = new sf::RenderWindow(sf::VideoMode(width, height), title, sf::Style::Titlebar | sf::Style::Close);
gameThread = new sf::Thread(&Game::run, window);
window->setActive(false);
sf::Event event;
gameThread->launch();
while (window->pollEvent(event)) {
if (event.type = sf::Event::Closed)
window->close();
delete &event;
}
gameThread->wait();
}
Game::~Game() {
delete &clock;
delete &window;
delete &gameThread;
clock = nullptr;
window = nullptr;
gameThread = nullptr;
}
void Game::run(sf::RenderWindow* window) {
while (window->isOpen()) {
window->clear();
window->display();
}
}
在sf :: Thread类的文档中,所有内容均在示例中进行了说明,但并没有说明我该怎么做。 Visual Studio只是说没有合适的默认构造函数。