static mrb_value surface_y(mrb_state *mrb, mrb_value self) { IDirectFBSurface* surface = mrb_directfb_surface(mrb, self); if (surface != NULL) { int y, dummy; DFBResult ret = surface->GetPosition(surface, &dummy, &y); if (!ret) { return mrb_fixnum_value(y); } } return mrb_nil_value(); }
static mrb_value surface_get_position(mrb_state *mrb, mrb_value self) { IDirectFBSurface* surface = mrb_directfb_surface(mrb, self); if (surface != NULL) { int x, y; DFBResult ret = surface->GetPosition(surface, &x, &y); if (!ret) { mrb_value pos[2]; pos[0] = mrb_fixnum_value(x); pos[1] = mrb_fixnum_value(y); return mrb_ary_new_from_values(mrb, 2, pos); } } return mrb_nil_value(); }