From 6dfa4f6b7d676e4ca0f113385f3b0cf6bf569eea Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Fri, 11 Apr 2014 13:34:19 +0200 Subject: [PATCH] MRI-Binding: Add 'Graphics.width/height' bindings (RGSS2) --- binding-mri/graphics-binding.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index df92610..a972fb8 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -99,6 +99,24 @@ RB_METHOD(graphicsFrameReset) DEF_GRA_PROP_I(FrameRate) DEF_GRA_PROP_I(FrameCount) +#ifdef RGSS2 + +RB_METHOD(graphicsWidth) +{ + RB_UNUSED_PARAM; + + return rb_fix_new(shState->graphics().width()); +} + +RB_METHOD(graphicsHeight) +{ + RB_UNUSED_PARAM; + + return rb_fix_new(shState->graphics().height()); +} + +#endif + DEF_GRA_PROP_B(Fullscreen) DEF_GRA_PROP_B(ShowCursor) @@ -120,6 +138,11 @@ void graphicsBindingInit() INIT_GRA_PROP_BIND( FrameRate, "frame_rate" ); INIT_GRA_PROP_BIND( FrameCount, "frame_count" ); +#ifdef RGSS2 + _rb_define_module_function(module, "width", graphicsWidth); + _rb_define_module_function(module, "height", graphicsHeight); +#endif + INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" ); INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" ); }