Add config option "fixedFramerate"
This commit is contained in:
parent
1759a1b4a9
commit
f5a178b9bb
4 changed files with 12 additions and 0 deletions
|
@ -37,6 +37,7 @@ Config::Config()
|
|||
vsync(false),
|
||||
defScreenW(640),
|
||||
defScreenH(480),
|
||||
fixedFramerate(0),
|
||||
solidFonts(false),
|
||||
gameFolder(".")
|
||||
{}
|
||||
|
@ -55,6 +56,7 @@ void Config::read()
|
|||
READ_VAL(vsync, Bool);
|
||||
READ_VAL(defScreenW, Int);
|
||||
READ_VAL(defScreenH, Int);
|
||||
READ_VAL(fixedFramerate, Int);
|
||||
READ_VAL(solidFonts, Bool);
|
||||
READ_VAL(gameFolder, ByteArray);
|
||||
READ_VAL(customScript, ByteArray);
|
||||
|
|
|
@ -40,6 +40,8 @@ struct Config
|
|||
int defScreenW;
|
||||
int defScreenH;
|
||||
|
||||
int fixedFramerate;
|
||||
|
||||
bool solidFonts;
|
||||
|
||||
QByteArray gameFolder;
|
||||
|
|
|
@ -451,6 +451,9 @@ Graphics::Graphics(RGSSThreadData *data)
|
|||
{
|
||||
p = new GraphicsPrivate;
|
||||
p->threadData = data;
|
||||
|
||||
if (data->config.fixedFramerate > 0)
|
||||
p->fpsLimiter.setDesiredFPS(data->config.fixedFramerate);
|
||||
}
|
||||
|
||||
Graphics::~Graphics()
|
||||
|
@ -580,6 +583,10 @@ DEF_ATTR_SIMPLE(Graphics, FrameCount, int, p->frameCount)
|
|||
void Graphics::setFrameRate(int value)
|
||||
{
|
||||
p->frameRate = clamp(value, 10, 120);
|
||||
|
||||
if (p->threadData->config.fixedFramerate > 0)
|
||||
return;
|
||||
|
||||
p->fpsLimiter.setDesiredFPS(p->frameRate);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue