Re: Moving frozen Bubble to the new SDL API

[email protected] (Guillaume Cottenceau)
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
Hi,

On Fri, Feb 5, 2010 at 3:49 AM, Kartik Thakore <[email protected]> wrote:
> HI Guillaume,
>
> Since most of the new SDL API is ready for frozen bubble I have started to
> move FB over to it.  Here is my work so far
> http://github.com/kthakore/frozen-bubble/tree/redesign you will need the
> SDL_perl from here http://github.com/kthakore/SDL_perl/tree/redesign

Why have you removed the sugar in your new sdlpl?


> However I am getting stuck at a particular location where you try to convert
> SDL::Surface to a hash_ref or something and send it to
> fb_c_stuff::rotate_bicubic
>
> The conversion is done at the subroutine surf.
>
>> sub surf {
>>     my ($surface) = @_;
>>     $surfstyle ||= UNIVERSAL::isa($surface, 'HASH') ? 'hashref' :
>> 'scalarref';
>>     return $surfstyle eq 'hashref' ? $surface->{-surface} : $$surface;
>> }

This is to be compatible with hashref style sdl (sdl 1.x I think) and
scalarref style sdl (sdl 2.x I think), to obtain the SDL_Surface*
needed for my XS stuff (rotate_bicubic and others).


> Since there are no comments here I am at a loss. Currently SDL::Surface as
> Opaque Objects in the typemap to prevent memory leaks. You can see the

Why being opaque prevents memory leaks?


> The code starts at line 2718.
>
>
>>         $canon{img}{$number} = SDL::Surface->new( SDL_ANYFORMAT,
>> $shooter->w, $shooter->h,  32, 0,0,0,0);
>>         fb_c_stuff::rotate_bicubic(surf($canon{img}{$number}),
>> surf($shooter), $angle);
>
> What is the need for surf here?
>
> Thanks for any help in advance.
>
> Cheers
> Kartik Thakore
>



-- 
Guillaume Cottenceau - http://zarb.org/~gc/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.