1
Graphics / Help a newbie have his window displayed :(
« on: April 22, 2012, 04:30:17 pm »
I have been trying to use sfml but alas, my first test program isn't even displaying the window. It complies fine but I can't see any window on the screen. I would be grateful if anyone points out the mistake.
Oh and sorry.. It should have been in the window section of forums. Extremely sorry!
Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
int main(int argc,char* argv[]){
sf::RenderWindow App(sf::VideoMode(800,600,32),"Render Window",sf::Style::Close,sf::WindowSettings(24,8,0));
bool running=true;
App.Clear(sf::Color(1,1,0));
while(running){
sf::Event E ;
while(App.GetEvent(E)){
if(E.Type==sf::Event::KeyPressed){
if(E.Key.Code==sf::Key::A)
App.Clear(sf::Color(1,0,0));
if(E.Key.Code==sf::Key::D)
App.Clear(sf::Color(0,0,1));
}
if(E.Type==sf::Event::MouseButtonPressed){
if(E.MouseButton.Button==sf::Mouse::Right)
running=false;
}
}
App.Display();
}
App.Close();
}
Oh and sorry.. It should have been in the window section of forums. Extremely sorry!