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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - LGV

Pages: [1]
1
General / Weird troubles when doing a loop inside main loop
« on: August 29, 2009, 04:14:29 am »
Hi, I have a problem that it's driving me crazy and I can't figure out how to avoid it. I was trying to this (App is a sf::RenderWindow, like in the tutorial "Using rendering windows")

Code: [Select]

while(App.IsOpened())
{
        for(;;)
        {
             if(App.GetInput().IsKeyDown(sf::Key::Escape) break;
             App.Clear(sf::Color(192, 192, 192));
        }

        // LOTS OF USEFUL CODE...

}

Well, this simple code, just doesn't work. I get no grey window (RGB 192,192,192 is grey), I can't get input so I can't "break" the loop. Worse, my entire machine gets really lag and almost lock up (!!). I just can't understand what I'm doing wrong. Any suggestions? I'm developing under Windows XP SP3 with Visual Studio 2008.
P.S: I was trying to do that because I'm doing a very simple menu for my game, so I need to get the game started when the user click on a button (I've already implemented this stuff and it works ok), but, until that, I have to show a menu or a picture so that is why I'm using a for( ;; ).

Pages: [1]