MRI-Binding: Add some RGSS2 Graphics bindings

This commit is contained in:
Jonas Kulla 2014-07-15 12:34:58 +02:00
parent 4a3a769b15
commit 7ad6b7b5df
1 changed files with 52 additions and 1 deletions

View File

@ -22,6 +22,7 @@
#include "graphics.h"
#include "sharedstate.h"
#include "binding-util.h"
#include "binding-types.h"
#include "exception.h"
RB_METHOD(graphicsUpdate)
@ -115,6 +116,52 @@ RB_METHOD(graphicsHeight)
return rb_fix_new(shState->graphics().height());
}
RB_METHOD(graphicsWait)
{
RB_UNUSED_PARAM;
int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().wait(duration);
return Qnil;
}
RB_METHOD(graphicsFadeout)
{
RB_UNUSED_PARAM;
int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().fadeout(duration);
return Qnil;
}
RB_METHOD(graphicsFadein)
{
RB_UNUSED_PARAM;
int duration;
rb_get_args(argc, argv, "i", &duration RB_ARG_END);
shState->graphics().fadein(duration);
return Qnil;
}
RB_METHOD(graphicsSnapToBitmap)
{
RB_UNUSED_PARAM;
Bitmap *result = 0;
GUARD_EXC( result = shState->graphics().snapToBitmap(); );
return wrapObject(result, BitmapType);
}
#endif
DEF_GRA_PROP_B(Fullscreen)
@ -139,8 +186,12 @@ void graphicsBindingInit()
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
#ifdef RGSS2
_rb_define_module_function(module, "width", graphicsWidth);
_rb_define_module_function(module, "width", graphicsWidth);
_rb_define_module_function(module, "height", graphicsHeight);
_rb_define_module_function(module, "wait", graphicsWait);
_rb_define_module_function(module, "fadeout", graphicsFadeout);
_rb_define_module_function(module, "fadein", graphicsFadein);
_rb_define_module_function(module, "snap_to_bitmap", graphicsSnapToBitmap);
#endif
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );