I was going through a video tutorial, and the person first shows drawing an image to the screen. However the put window.draw(image_obj) to draw to their screen...when i do the same i get an error for sf::Window has no member draw? My intentions was that is what is suppose to draw the image to screen as shown on the tutorial. The video is using sfml 2.0 and i am using 2.1.
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
class Control{
public:
sf::Window window;
sf::Time time;
sf::Clock clock;
sf::Sprite player;
sf::Texture texture;
Control(){
window.create(sf::VideoMode(600,400), "Title");
window.setKeyRepeatEnabled(false);
if(!(texture.loadFromFile("/home/metulburr/Pictures/explode.jpeg")))
std::cout << "could not load image" << std::endl;
player.setTexture(texture);
}
void run(){
while (window.isOpen()){
sf::Event event;
while(window.pollEvent(event)){
if (event.type == sf::Event::Closed){
window.close();
}
}
window.clear(sf::Color::Black);
window.draw(player);
window.display();
time = clock.restart();
}
}
};
int main(){
Control app;
app.run();
}
and i get the error:
est.cpp: In member function ‘void Control::run()’:
test.cpp:29:24: error: ‘class sf::Window’ has no member named ‘clear’
window.clear(sf::Color::Black);
^
test.cpp:30:24: error: ‘class sf::Window’ has no member named ‘draw’
window.draw(player);
^