diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index 6b39697..f52d078 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -202,6 +202,8 @@ DEF_GRA_PROP_I(Brightness) DEF_GRA_PROP_B(Fullscreen) DEF_GRA_PROP_B(ShowCursor) +DEF_GRA_PROP_B(FixedAspectRatio) + #define INIT_GRA_PROP_BIND(PropName, prop_name_s) \ { \ _rb_define_module_function(module, prop_name_s, graphics##Get##PropName); \ @@ -222,6 +224,8 @@ void graphicsBindingInit() INIT_GRA_PROP_BIND( FrameRate, "frame_rate" ); INIT_GRA_PROP_BIND( FrameCount, "frame_count" ); + INIT_GRA_PROP_BIND( FixedAspectRatio, "fixed_aspect_ratio" ); + if (rgssVer >= 2) { _rb_define_module_function(module, "width", graphicsWidth); diff --git a/src/graphics.cpp b/src/graphics.cpp index 687cb3e..7836c1b 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -1024,6 +1024,20 @@ void Graphics::setShowCursor(bool value) p->threadData->ethread->requestShowCursor(value); } +bool Graphics::getFixedAspectRatio() const +{ + // It's a bit hacky to expose config values as a Graphics + // attribute, but there's really no point in state duplication + return shState->config().fixedAspectRatio; +} + +void Graphics::setFixedAspectRatio(bool value) +{ + shState->config().fixedAspectRatio = value; + p->recalculateScreenSize(p->threadData); + p->updateScreenResoRatio(p->threadData); +} + Scene *Graphics::getScreen() const { return &p->screen; diff --git a/src/graphics.h b/src/graphics.h index aa30189..6ca2efc 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -62,6 +62,8 @@ public: DECL_ATTR( Fullscreen, bool ) DECL_ATTR( ShowCursor, bool ) + DECL_ATTR( FixedAspectRatio, bool ) + /* */ Scene *getScreen() const; /* Repaint screen with static image until exitCond