void windowBindingInit() { VALUE klass = rb_define_class("Window", rb_cObject); rb_define_alloc_func(klass, classAllocate<&WindowType>); disposableBindingInit <Window>(klass); viewportElementBindingInit<Window>(klass); _rb_define_method(klass, "initialize", windowInitialize); _rb_define_method(klass, "update", windowUpdate); INIT_PROP_BIND( Window, Windowskin, "windowskin" ); INIT_PROP_BIND( Window, Contents, "contents" ); INIT_PROP_BIND( Window, Stretch, "stretch" ); INIT_PROP_BIND( Window, CursorRect, "cursor_rect" ); INIT_PROP_BIND( Window, Active, "active" ); INIT_PROP_BIND( Window, Pause, "pause" ); INIT_PROP_BIND( Window, X, "x" ); INIT_PROP_BIND( Window, Y, "y" ); INIT_PROP_BIND( Window, Width, "width" ); INIT_PROP_BIND( Window, Height, "height" ); INIT_PROP_BIND( Window, OX, "ox" ); INIT_PROP_BIND( Window, OY, "oy" ); INIT_PROP_BIND( Window, Opacity, "opacity" ); INIT_PROP_BIND( Window, BackOpacity, "back_opacity" ); INIT_PROP_BIND( Window, ContentsOpacity, "contents_opacity" ); }
void etcBindingInit() { VALUE klass; INIT_BIND(Color); RB_ATTR_RW(Color, Red, red); RB_ATTR_RW(Color, Green, green); RB_ATTR_RW(Color, Blue, blue); RB_ATTR_RW(Color, Alpha, alpha); INIT_BIND(Tone); RB_ATTR_RW(Tone, Red, red); RB_ATTR_RW(Tone, Green, green); RB_ATTR_RW(Tone, Blue, blue); RB_ATTR_RW(Tone, Gray, gray); INIT_BIND(Rect); RB_ATTR_RW(Rect, X, x); RB_ATTR_RW(Rect, Y, y); RB_ATTR_RW(Rect, Width, width); RB_ATTR_RW(Rect, Height, height); _rb_define_method(klass, "empty", rectEmpty); }
void fileIntBindingInit() { VALUE klass = rb_define_class("FileInt", rb_cIO); rb_define_alloc_func(klass, classAllocate<&FileIntType>); _rb_define_method(klass, "read", fileIntRead); _rb_define_method(klass, "getbyte", fileIntGetByte); _rb_define_method(klass, "binmode", fileIntBinmode); _rb_define_method(klass, "close", fileIntClose); _rb_define_module_function(rb_mKernel, "load_data", kernelLoadData); _rb_define_module_function(rb_mKernel, "save_data", kernelSaveData); /* We overload the built-in 'Marshal::load()' function to silently * insert our utf8proc that ensures all read strings will be * UTF-8 encoded */ VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); rb_define_alias(rb_singleton_class(marsh), "_mkxp_load_alias", "load"); _rb_define_module_function(marsh, "load", _marshalLoad); }
void tableBindingInit() { INIT_TYPE(Table); VALUE klass = rb_define_class("Table", rb_cObject); rb_define_alloc_func(klass, classAllocate<&TableType>); serializableBindingInit<Table>(klass); rb_define_class_method(klass, "_load", TableLoad); _rb_define_method(klass, "initialize", tableInitialize); _rb_define_method(klass, "resize", tableResize); _rb_define_method(klass, "xsize", tableXSize); _rb_define_method(klass, "ysize", tableYSize); _rb_define_method(klass, "zsize", tableZSize); _rb_define_method(klass, "[]", tableGetAt); _rb_define_method(klass, "[]=", tableSetAt); }
void fontBindingInit() { VALUE klass = rb_define_class("Font", rb_cObject); rb_define_alloc_func(klass, classAllocate<&FontType>); Font::initDefaultDynAttribs(); wrapProperty(klass, &Font::getDefaultColor(), "default_color", ColorType); rb_iv_set(klass, "default_name", rb_str_new_cstr(Font::getDefaultName())); if (rgssVer >= 3) wrapProperty(klass, &Font::getDefaultOutColor(), "default_out_color", ColorType); INIT_KLASS_PROP_BIND(Font, DefaultName, "default_name"); INIT_KLASS_PROP_BIND(Font, DefaultSize, "default_size"); INIT_KLASS_PROP_BIND(Font, DefaultBold, "default_bold"); INIT_KLASS_PROP_BIND(Font, DefaultItalic, "default_italic"); INIT_KLASS_PROP_BIND(Font, DefaultColor, "default_color"); if (rgssVer >= 2) { INIT_KLASS_PROP_BIND(Font, DefaultShadow, "default_shadow"); } if (rgssVer >= 3) { INIT_KLASS_PROP_BIND(Font, DefaultOutline, "default_outline"); INIT_KLASS_PROP_BIND(Font, DefaultOutColor, "default_out_color"); } rb_define_class_method(klass, "exist?", fontDoesExist); _rb_define_method(klass, "initialize", fontInitialize); _rb_define_method(klass, "initialize_copy", fontInitializeCopy); INIT_PROP_BIND(Font, Name, "name"); INIT_PROP_BIND(Font, Size, "size"); INIT_PROP_BIND(Font, Bold, "bold"); INIT_PROP_BIND(Font, Italic, "italic"); INIT_PROP_BIND(Font, Color, "color"); if (rgssVer >= 2) { INIT_PROP_BIND(Font, Shadow, "shadow"); } if (rgssVer >= 3) { INIT_PROP_BIND(Font, Outline, "outline"); INIT_PROP_BIND(Font, OutColor, "out_color"); } if (rgssVer >= 2) { VALUE defNames = rb_ary_new2(3); rb_ary_push(defNames, rb_str_new2("Verdana")); rb_ary_push(defNames, rb_str_new2("Arial")); rb_ary_push(defNames, rb_str_new2("Courier New")); FontSetDefaultName(1, &defNames, klass); } }