【发布时间】:2016-05-05 10:55:13
【问题描述】:
我的 DrawCircles(window) 有问题;方法。
当我尝试传入“窗口”时,我的标题中出现错误。
知道如何解决这个问题吗?此外,将不胜感激,谢谢。
这是我的代码:
#include <SFML/Graphics.hpp>
#include <vector>
using namespace std;
vector<sf::CircleShape> Shapes;
int main() {
sf::RenderWindow window(sf::VideoMode(1280, 720), "Conduit");
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
DrawCircles(window); // ERROR IS THIS LINE.
//window.draw(shape);
window.display();
}
}
void RenderCircle()
{
sf::CircleShape shape;
shape.setRadius(40.f);
shape.setPosition(100.f, 100.f);
shape.setFillColor(sf::Color::Cyan);
Shapes.push_back(shape);
}
void DrawCircles(sf::RenderWindow window)
{
for (int i = 0; i < Shapes.size(); i++)
{
window.draw(Shapes.at(i));
}
}
【问题讨论】:
-
我该怎么做?