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

Author Topic: Simple open-window tutorial problem...  (Read 1775 times)

0 Members and 1 Guest are viewing this topic.

Christopher Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Simple open-window tutorial problem...
« on: December 22, 2011, 11:08:25 pm »
I got the window to finally open by adding all the correct things but now, the window opens and flashes abunch of colors and wont let me exit. I added a exit button (ESC key) But I have to force stop it. Any idea's?
Noob C++ Programmer.

Turbine

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Simple open-window tutorial problem...
« Reply #1 on: December 23, 2011, 03:57:50 am »
Have you got your events set up properly?

In main, somewhere after window create, something like this.
Code: [Select]
  sf::Event event;
   while (window.PollEvent(event))
   {
      switch(event.Type)
      {
      case sf::Event::Closed:
         return EXIT_SUCCESS;
         break;

      case sf::Event::KeyPressed:
         if (event.Key.Code == sf::Keyboard::Escape)
            return EXIT_SUCCESS;
         break;
      }
   }


Or returning from the programs execution window, window.Close().

Christopher Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Simple open-window tutorial problem...
« Reply #2 on: December 23, 2011, 06:10:05 pm »
Fixed it, found some other resources (tutorials) and I had my stuff setup wrong. Ill try figuring stuff out before i post something like this again :P
Noob C++ Programmer.