Add config option "fixedFramerate"

This commit is contained in:
Jonas Kulla 2013-10-17 02:18:16 +02:00
parent 1759a1b4a9
commit f5a178b9bb
4 changed files with 12 additions and 0 deletions

View File

@ -77,6 +77,7 @@ mkxp reads configuration data from the file "mkxp.conf" contained in the current
| vsync | bool | false | Sync screen redraws to the monitor refresh rate |
| defScreenW | int | 640 | Width the game window starts in (this is **not** the game resolution) |
| defScreenH | int | 480 | Height the game window starts in |
| fixedFramerate | int | 0 | FPS will be fixed to this amount. Ignored if 0. |
| solidFonts | bool | false | Don't use alpha blending for fonts |
| gameFolder | string | "." | mkxp will look for all game related files here |
| customScript | string | "" | Execute a raw ruby script file instead of an RPG Maker game. |

View File

@ -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);

View File

@ -40,6 +40,8 @@ struct Config
int defScreenW;
int defScreenH;
int fixedFramerate;
bool solidFonts;
QByteArray gameFolder;

View File

@ -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);
}