From: Kartik Thakore Date: Wed, 9 Sep 2009 23:57:17 +0000 (-0400) Subject: Using Rect as Blessed but backward compatible constructor. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2daadb0ff98610f8137906c0b0b7f310a0b7eb9e;hp=8bd94773eeb62f65b5e67a0eb7ec60a23cf96baf;p=sdlgit%2FSDL_perl.git Using Rect as Blessed but backward compatible constructor. --- diff --git a/src/Rect.xs b/src/Rect.xs index 61b8c4e..0744f30 100644 --- a/src/Rect.xs +++ b/src/Rect.xs @@ -10,17 +10,21 @@ -MODULE = SDL::Rect PACKAGE = SDL::Rect +MODULE = SDL::Rect PACKAGE = SDL::Rect PREFIX = rect_ SDL_Rect * -new (CLASS) +rect_new (CLASS, x, y, w, h) char* CLASS + Sint16 x + Sint16 y + Uint16 w + Uint16 h CODE: RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect)); - RETVAL->x = 0; - RETVAL->y = 0; - RETVAL->w = 0; - RETVAL->h = 0; + RETVAL->x = x; + RETVAL->y = y; + RETVAL->w = w; + RETVAL->h = h; OUTPUT: RETVAL @@ -76,7 +80,7 @@ RectH ( rect, ... ) void -DESTROY(self) +rect_DESTROY(self) SDL_Rect *self CODE: printf("RectPtr::DESTROY\n"); diff --git a/t/rectpm.t b/t/rectpm.t index 2414ec2..8e4dcc0 100644 --- a/t/rectpm.t +++ b/t/rectpm.t @@ -55,7 +55,7 @@ can_ok ('SDL::Rect', qw/ left /); -my $rect = SDL::Rect->new(); +my $rect = SDL::Rect->new(0,0,0,0); # creating with defaults isa_ok ($rect,'SDL::Rect');