protected void gameLoop ( ) throws SlickException { int delta = getDelta ( ) ; if ( ! Display . isVisible ( ) && updateOnlyOnVisible ) { try { Thread . sleep ( 100 ) ; } catch ( Exception e ) { } } else { try { updateAndRender ( delta ) ; } catch ( SlickException e ) { Log . error ( e ) ; running = false ; return ; } } updateFPS ( ) ; Display . update ( ) ; if ( Display . isCloseRequested ( ) ) { if ( game . closeRequested ( ) ) { running = false ; } } }
Strategy for overloading game loop context handling