So I just recently built SFML2 and wanted to familiarize myself with the new stuff.
There I was, making a super simple program when it started complaining about sf::Key not being declared. I just thought that I made a typo or something but then I copy-pasted the code from
here and it still complained.
What's the deal?
Here's what I got so far.
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
int main(){
sf::RenderWindow mainWindow(sf::VideoMode(800, 600,32), "SFML window");
mainWindow.Clear(sf::Color(46,40,35));
sf::Text text;
text.SetString("TEXT FOR THE SCREEN");
text.SetPosition(200,200);
mainWindow.Draw(text);
mainWindow.Display();
while(true){
sf::Event currentEvent;
mainWindow.PollEvent(currentEvent);
if(currentEvent.Type == sf::Event::Closed){
return EXIT_FAILURE;
}
if ((currentEvent.Type == sf::Event::KeyPressed) && (currentEvent.Key.Code == sf::Key::Escape)){ // here's the problem
printf("%i\n", currentEvent.Key.Code);
return EXIT_SUCCESS;
}
}
return EXIT_SUCCESS;
}