SFML community forums

Help => Window => Topic started by: katrin on October 10, 2008, 02:37:10 pm

Title: no game loop: display() problems
Post by: katrin on October 10, 2008, 02:37:10 pm
hi folks,

first of all, i don't use a typical game loop since i'd like to prepare one screen while showing the other. thus i have at least two screens:

 
Code: [Select]

    sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();    
    sf::RenderWindow Screen[2] ;                                    

    for( i = 0 ; i < 2 ; i++ ) {                                    
        Screen[ i ].Create( DesktopMode, "", sf::Style::None ) ;  
        Screen[ i ].Show( true ) ;                                  
        Screen[ i ].SetFramerateLimit( 0 ) ;                        
        Screen[ i ].UseVerticalSync( true );                        
        Screen[ i ].ShowMouseCursor( false ) ;                    
        Screen[ i ].SetBackgroundColor(sf::Color(255, 255, 255));  
    }

    for( i = 0 ; i < 2 ; i++ ) {                                  
        Screen[ i ].Display() ;                                    
        Screen[ i ].Show( false ) ;
    }
    ...


now, one screen gets prepared, while showing the other:

Code: [Select]


    Screen[ 0 ].Show( true ) ;
    Screen[ 1 ].Show( false ) ;
    Clock.Reset() ;
    Screen[ 0 ].Display() ;                                        
    Screen[ 1 ].Draw( text ) ;                                    
    WaitUntilMS( Clock, 500 ) ;  // waiting for 500ms

    Screen[ 1 ].Show( true ) ;
    Screen[ 0 ].Show( false ) ;
    Clock.Reset() ;
    Screen[ 1 ].Display() ;
    Screen[ 0 ].Draw( anothertext ) ;                                    
    WaitUntilMS( Clock, 50 ) ;  // waiting for 50ms

    Screen[ 0 ].Show( true ) ;
    Screen[ 1 ].Show( false ) ;
    Clock.Reset() ;
    Screen[ 0 ].Display() ;
    Screen[ 1 ].Draw( yetanothertext ) ;                                      
    WaitUntilMS( Clock,50 ) ; // waiting for 50ms
   ...


this code works perfectly well on some computers, but not on others. on the non-working machines the first two displays are okay, while the third display shows a blend of display one and three.

does anybody have any idea or solution or works with muliple screens? my main goal is to prepare one screen, while showing the other.

any help is appreciated,
thanx
katrin
Title: no game loop: display() problems
Post by: Laurent on October 10, 2008, 03:20:58 pm
Which OS ? Which version of SFML ?

Have you tried with the latest sources from SVN ?
Title: no game loop: display() problems
Post by: katrin on October 10, 2008, 04:14:17 pm
Quote from: "Laurent"
Which OS ? Which version of SFML ?


windows xp sp3, sfml 1.3

Quote from: "Laurent"
Have you tried with the latest sources from SVN ?


nope  :wink:
Title: no game loop: display() problems
Post by: Laurent on October 10, 2008, 04:39:23 pm
This problem might be solved in the current sources ; if you can, I advise you to try the SVN version.
Title: no game loop: display() problems
Post by: katrin on October 10, 2008, 05:36:40 pm
Quote from: "Laurent"
This problem might be solved in the current sources ; if you can, I advise you to try the SVN version.


okay, i'll try ... but just for the sake of correctness (since that goes beyond, what i usually can do  :)  ) i would be done with compiling the sfml-[] release dll_win32 and copy the *.a and *.dll files to the corresponding places?!

thanks
Title: no game loop: display() problems
Post by: Laurent on October 10, 2008, 05:45:42 pm
Yes. You'll have to copy the new headers, too.