Sha256: 8edaf7c75b2358de538fc9a22242c6e33e5854474f4aabb4725e396dd273ebb2
Contents?: true
Size: 1.42 KB
Versions: 5
Compression:
Stored size: 1.42 KB
Contents
#include "reflex/ruby/shape_view.h" #include <rucy.h> #include <rays/ruby/point.h> using namespace Rucy; using Reflex::coord; RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::RectShape) #define THIS to<Reflex::RectShape*>(self) #define CHECK RUCY_CHECK_OBJECT(Reflex::RectShape, self) #define CALL(fun) RUCY_WRAPPER_CALL(Reflex::RectShape, THIS, fun) static VALUE alloc(VALUE klass) { return value(new Reflex::RubyShapeView<Reflex::RectShape>, klass); } static VALUE set_round(VALUE self) { CHECK; check_arg_count(__FILE__, __LINE__, "RectShape#set_fill", argc, 1, 2); if (argc == 1 && argv[0].is_kind_of(Rays::point_class())) THIS->set_round(to<Rays::Point&>(argv[0])); else { float w = to<float>(argv[0]); float h = (argc >= 2) ? to<float>(argv[1]) : 1; THIS->set_round(w, h); } return self; } static VALUE get_round(VALUE self) { CHECK; return value(THIS->round()); } static RUCY_DEF_clear_override_flags(cof, Reflex::RectShape); static Class cRectShape; void Init_rect_shape () { Module mReflex = rb_define_module("Reflex"); cRectShape = mReflex.define_class("RectShape", Reflex::shape_view_class()); rb_define_alloc_func(cRectShape, alloc); rb_define_private_method(cRectShape, "round=", RUBY_METHOD_FUNC(set_round), -1); rb_define_method(cRectShape, "round", RUBY_METHOD_FUNC(get_round), 0); } namespace Reflex { Class rect_shape_class () { return cRectShape; } }// Reflex
Version data entries
5 entries across 5 versions & 1 rubygems