render when visible only
This commit is contained in:
		
							父節點
							
								
									caded3285c
								
							
						
					
					
						當前提交
						71b6fb0590
					
				| 
						 | 
					@ -75,11 +75,13 @@ void Engine::run()
 | 
				
			||||||
        update(ticks - lastFrameTicks);
 | 
					        update(ticks - lastFrameTicks);
 | 
				
			||||||
        lastFrameTicks = ticks;
 | 
					        lastFrameTicks = ticks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // render
 | 
					        // render only when visible
 | 
				
			||||||
        render();
 | 
					        if(Platform::isWindowVisible()) {
 | 
				
			||||||
 | 
					            render();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // swap buffers
 | 
					            // swap buffers
 | 
				
			||||||
        Platform::swapBuffers();
 | 
					            Platform::swapBuffers();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lastFrameTicks = 0;
 | 
					    lastFrameTicks = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue