#include "stdafx.h"
#include "SFML/Graphics.hpp"
#include "SFML/Window.hpp"
usingnamespace sf;
int main()
{
VideoMode videoMode(320,240);
Window window(videoMode,"Rectangle Window");
RectangleShape rectangle;
rectangle.setPosition(30,30);
rectangle.setSize(Vector2f(50, 30));
rectangle.setFillColor(Color::Yellow);
rectangle.setOutlineColor(Color::Blue);
rectangle.setOutlineThickness(5);
while(window.isOpen())
{
window.clear();
window.draw(rectangle);
window.display();
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed){window.close();}
elseif (event.type == Event::KeyPressed && event.key.code == Keyboard::Escape) {window.close();}
else
{
if (event.type == Event::KeyPressed)
{
switch(event.key.code)
{
case Keyboard::Up: rectangle.move(0,-10);
break;
case Keyboard::Down: rectangle.move(0,10);
break;
case Keyboard::Left: rectangle.move(-10,0);
break;
case Keyboard::Right: rectangle.move(10,0);
break;
}
}
}
}
}
return EXIT_SUCCESS;
}
Exept for the window.clear(); and window.draw(rectangle);.
I have installed sfml four times now, linker, directories, and everything in different projects but it still wont work. But yet I still get this : error C2039: 'clear' : is not a member of 'sf::Window'
What did I do wrong?