mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-01 14:15:16 +02:00
Bind Graphics.frameskip
property
This commit is contained in:
parent
6b0ffa069f
commit
d7337bce6f
4 changed files with 23 additions and 6 deletions
|
@ -242,7 +242,8 @@ DEF_GRA_PROP_I(Brightness)
|
|||
|
||||
DEF_GRA_PROP_B(Fullscreen)
|
||||
DEF_GRA_PROP_B(ShowCursor)
|
||||
DEF_GRA_PROP_F(Scale);
|
||||
DEF_GRA_PROP_F(Scale)
|
||||
DEF_GRA_PROP_B(Frameskip)
|
||||
|
||||
#define INIT_GRA_PROP_BIND(PropName, prop_name_s) \
|
||||
{ \
|
||||
|
@ -286,4 +287,5 @@ void graphicsBindingInit()
|
|||
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
|
||||
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
|
||||
INIT_GRA_PROP_BIND( Scale, "scale" );
|
||||
INIT_GRA_PROP_BIND( Frameskip, "frameskip" );
|
||||
}
|
||||
|
|
|
@ -114,7 +114,9 @@
|
|||
// "fixedFramerate": 0,
|
||||
|
||||
|
||||
// Skip (don't draw) frames when behind
|
||||
// Skip (don't draw) frames when behind.
|
||||
// Can be changed at runtime, but this is the
|
||||
// default value when the game starts.
|
||||
// (default: disabled)
|
||||
//
|
||||
// "frameSkip": false,
|
||||
|
|
|
@ -425,6 +425,9 @@ struct GraphicsPrivate {
|
|||
|
||||
FPSLimiter fpsLimiter;
|
||||
|
||||
// Can be set from Ruby. Takes priority over config setting.
|
||||
bool useFrameSkip;
|
||||
|
||||
bool frozen;
|
||||
TEXFBO frozenScene;
|
||||
Quad screenQuad;
|
||||
|
@ -438,7 +441,8 @@ struct GraphicsPrivate {
|
|||
winSize(rtData->config.defScreenW, rtData->config.defScreenH),
|
||||
screen(scRes.x, scRes.y), threadData(rtData),
|
||||
glCtx(SDL_GL_GetCurrentContext()), frameRate(DEF_FRAMERATE),
|
||||
frameCount(0), brightness(255), fpsLimiter(frameRate), frozen(false) {
|
||||
frameCount(0), brightness(255), fpsLimiter(frameRate),
|
||||
useFrameSkip(rtData->config.frameSkip), frozen(false) {
|
||||
recalculateScreenSize(rtData);
|
||||
updateScreenResoRatio(rtData);
|
||||
|
||||
|
@ -595,7 +599,7 @@ void Graphics::update() {
|
|||
return;
|
||||
|
||||
if (p->fpsLimiter.frameSkipRequired()) {
|
||||
if (p->threadData->config.frameSkip) {
|
||||
if (p->useFrameSkip) {
|
||||
/* Skip frame */
|
||||
p->fpsLimiter.delay();
|
||||
++p->frameCount;
|
||||
|
@ -928,7 +932,11 @@ void Graphics::reset() {
|
|||
setBrightness(255);
|
||||
}
|
||||
|
||||
void Graphics::center() { p->threadData->ethread->requestWindowCenter(); }
|
||||
void Graphics::center() {
|
||||
if (getFullscreen())
|
||||
return;
|
||||
p->threadData->ethread->requestWindowCenter();
|
||||
}
|
||||
|
||||
bool Graphics::getFullscreen() const {
|
||||
return p->threadData->ethread->getFullscreen();
|
||||
|
@ -968,6 +976,10 @@ void Graphics::setScale(double factor) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Graphics::getFrameskip() const { return p->useFrameSkip; }
|
||||
|
||||
void Graphics::setFrameskip(bool value) { p->useFrameSkip = value; }
|
||||
|
||||
Scene *Graphics::getScreen() const { return &p->screen; }
|
||||
|
||||
void Graphics::repaintWait(const AtomicFlag &exitCond, bool checkReset) {
|
||||
|
|
|
@ -63,7 +63,8 @@ public:
|
|||
/* Non-standard extension */
|
||||
DECL_ATTR( Fullscreen, bool )
|
||||
DECL_ATTR( ShowCursor, bool )
|
||||
DECL_ATTR( Scale, double )
|
||||
DECL_ATTR( Scale, double )
|
||||
DECL_ATTR( Frameskip, bool )
|
||||
|
||||
/* <internal> */
|
||||
Scene *getScreen() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue