SFML community forums

Help => Graphics => Topic started by: Snyp on April 22, 2012, 04:30:17 pm

Title: Help a newbie have his window displayed :(
Post by: Snyp 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.
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!
Title: Re: Help a newbie have his window displayed :(
Post by: Andrew_sl on July 07, 2012, 01:44:53 pm
Hello.
Help with this problem. I have the same. When you start the program displays the console and nothing else happens.
Thanks.
Title: Re: Help a newbie have his window displayed :(
Post by: eXpl0it3r on July 07, 2012, 02:02:58 pm
The problem lies within SFML 1.6 and your ATI graphics card, aka ATI bug.

Use SFML 2 and your window will appear again. ;)
Title: Re: Help a newbie have his window displayed :(
Post by: Andrew_sl on July 07, 2012, 02:57:09 pm
Sorry for my bad english... ))
Unfortunately, the use of SMFL 2.0 did not solve the problem.
I built the project with the aid of CMake guided by this -  http://www.youtube.com/watch?v=cDNo4bzrFW8&feature=relmfu  .... but nothing changed: (
Looking through the forums chose SMFL ... really need to learn SDL or freeglut ... they say, is more complicated.
If possible please suggest an idea what could be the problem and / or solutions.
Title: Re: Help a newbie have his window displayed :(
Post by: eXpl0it3r on July 07, 2012, 03:16:43 pm
If you were able to use the same code as posted above then you're still using SFML 1.6...

Also SFML 2 has already binaries for the release candidate (http://www.sfml-dev.org/download.php#2.0-rc) so there's no need to build it on your own (but you could of course).

... really need to learn SDL or freeglut ...
No not really, SFML is better than SDL. :P

Can your run the examples that come with the SFML 2.0rc package?
If not then there's some strange problem with your PC setup, e.g. do you use the latest graphics card driver?
If you can run them, then either your code is wrong or your project setup is wrong.
Title: Re: Help a newbie have his window displayed :(
Post by: Andrew_sl on July 08, 2012, 06:39:49 pm
Thank u eXpl0it3r! U were right.
Sorry I do not see the buttons like "thank you".