Advertisement

Basic SFML problem, graphics

Started by May 21, 2014 11:28 PM
2 comments, last by kidman171 10 years, 8 months ago

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

using namespace std;

int main()
{
	sf::RenderWindow window;

	window.create(sf::VideoMode(800, 600), "Myne");

	while (window.isOpen())
	{

		sf::Event event;
		while (window.pollEvent(event))
		{

			if (event.type == sf::Event::Closed)
			{
				window.close();
			}

			window.clear(sf::Color::Black);


			window.display();
		}


	} 

ok so im going through the tutorials for SFML on visual studios for windows, trying to figure stuff out as i go. i did the test program, worked. i also did the first window tutorial program, also worked. im tinkering with the graphics stuff, so i can put something simple in my window. but im getting an error 'RenderWindow' is not a member of sf. any help would be appreciated!

here's my code, ive googled this and cant really find any answers that work

Figured it out, was using the wrong header. didnt notice it had changed in the tutorial

Advertisement

RenderWindow must be in Graphics.hpp if I'm not wrong

As a side note, you should not be clearing and displaying the window inside the while-loop that you are using to poll events. You should only clear and display once per frame.

This topic is closed to new replies.

Advertisement