SFML Still Wont install

So, I tried to install sdl and ended up installing sfml. The program works, but this code works:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "stdafx.h"
#include "SFML/Graphics.hpp"
#include "SFML/Window.hpp"
using namespace 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();}
			else if (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?
Last edited on
Try changing Window to RenderWindow.
Ok Well I got This four times in two lines:
error C2143: syntax error : missing ';' before '.'
this is what it looks like now :
1
2
	RenderWindow.clear();
	RenderWindow.draw(rectangle);   
I meant in your declaration, change Window window(videoMode,"Rectangle Window"); to RenderWindow window(videoMode,"Rectangle Window");
Thanks So much! Im Guessing that changed between 1.6 to 2.0?
Topic archived. No new replies allowed.