Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help a newbie have his window displayed :(  (Read 2120 times)

0 Members and 1 Guest are viewing this topic.

Snyp

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
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.
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!
« Last Edit: April 22, 2012, 04:55:46 pm by Snyp »

Andrew_sl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Help a newbie have his window displayed :(
« Reply #1 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Help a newbie have his window displayed :(
« Reply #2 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Andrew_sl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Help a newbie have his window displayed :(
« Reply #3 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 -    .... 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.
« Last Edit: July 07, 2012, 03:07:27 pm by Andrew_sl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Help a newbie have his window displayed :(
« Reply #4 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 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Andrew_sl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Help a newbie have his window displayed :(
« Reply #5 on: July 08, 2012, 06:39:49 pm »
Thank u eXpl0it3r! U were right.
Sorry I do not see the buttons like "thank you".