Gaphics: Make frame skip a config option
When using something like Valgrind that will run mkxp 20 times slower than normal, frame skip will make the redraw loop completely grind to a halt. Set 'frameSkip' to false in the config to avert this.
This commit is contained in:
		
							parent
							
								
									c504a383ba
								
							
						
					
					
						commit
						19bb6c924e
					
				
					 4 changed files with 17 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -38,6 +38,7 @@ Config::Config()
 | 
			
		|||
      defScreenW(640),
 | 
			
		||||
      defScreenH(480),
 | 
			
		||||
      fixedFramerate(0),
 | 
			
		||||
      frameSkip(true),
 | 
			
		||||
      solidFonts(false),
 | 
			
		||||
      gameFolder("."),
 | 
			
		||||
      allowSymlinks(false)
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +59,7 @@ void Config::read()
 | 
			
		|||
	READ_VAL(defScreenW, Int);
 | 
			
		||||
	READ_VAL(defScreenH, Int);
 | 
			
		||||
	READ_VAL(fixedFramerate, Int);
 | 
			
		||||
	READ_VAL(frameSkip, Bool);
 | 
			
		||||
	READ_VAL(solidFonts,  Bool);
 | 
			
		||||
	READ_VAL(gameFolder, ByteArray);
 | 
			
		||||
	READ_VAL(allowSymlinks, Bool);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@ struct Config
 | 
			
		|||
	int defScreenH;
 | 
			
		||||
 | 
			
		||||
	int fixedFramerate;
 | 
			
		||||
	bool frameSkip;
 | 
			
		||||
 | 
			
		||||
	bool solidFonts;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -583,12 +583,20 @@ void Graphics::update()
 | 
			
		|||
 | 
			
		||||
	if (p->fpsLimiter.frameSkipRequired())
 | 
			
		||||
	{
 | 
			
		||||
		/* Skip frame */
 | 
			
		||||
		p->fpsLimiter.delay();
 | 
			
		||||
		++p->frameCount;
 | 
			
		||||
		p->threadData->ethread->notifyFrame();
 | 
			
		||||
		if (p->threadData->config.frameSkip)
 | 
			
		||||
		{
 | 
			
		||||
			/* Skip frame */
 | 
			
		||||
			p->fpsLimiter.delay();
 | 
			
		||||
			++p->frameCount;
 | 
			
		||||
			p->threadData->ethread->notifyFrame();
 | 
			
		||||
 | 
			
		||||
		return;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			/* Just reset frame adjust counter */
 | 
			
		||||
			p->fpsLimiter.resetFrameAdjust();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	p->checkResize();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue