[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] p4a animation lag



sweet, this is a lot of good information. I've incorporated the
convert bit and I'm pushing to the phone now to see. I'll look at the
other pieces as well.

The good news is the music is working well on android, I've got a
background music track playing along with individual sounds for my
characters' various attacks. Sounds killer.


On Fri, Dec 30, 2011 at 1:38 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
> Hi,
>
> after you convert(), it should definitely be much faster.
>
> If you don't change the whole background, it might be good just to redraw
> the part you are changing.  It can be easy to use the sprite.DirtySprite and
> sprite.LayeredDirty for this.  Or if your other images are completely over
> writing it, then you do not need to draw the background at all.  You want to
> avoid 'overdraw' of pixels if possible, and the work tracking what pixels
> you have drawn already is less than the work drawing those pixels.
>
> Also, the .fill() method is often very fast compared to blit, so that might
> be appropriate for you.
>
> cheers,
>
>
>
> On Fri, Dec 30, 2011 at 5:18 PM, Sean Wolfe <ether.joe@xxxxxxxxx> wrote:
>>
>> I have *not* converted the surfaces ... I will try that!
>>
>> I'm blitting the background to basically clear the screen for the next
>> frame. Is there a better way to do this?
>>
>> Thanks for the pointer...
>>
>>
>>
>> On Fri, Dec 30, 2011 at 1:05 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
>> > Hi,
>> >
>> > Do you need to blit the background each time?
>> >
>> > Have you used convert() on the surfaces?
>> >
>> > cheers,
>> >
>> >
>> > On Fri, Dec 30, 2011 at 5:00 PM, Sean Wolfe <ether.joe@xxxxxxxxx> wrote:
>> >>
>> >> Don't have to click for every frame, it will run the whole list of
>> >> frames on a single mousebuttondown.
>> >>
>> >> And the blit of the background takes care of drawing on top of one
>> >> another.
>> >>
>> >> Anybody have any ideas about the lag though? Maybe we need a p4a port
>> >> to the Android native kit.
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Dec 29, 2011 at 6:59 PM, Ian Mallett <geometrian@xxxxxxxxx>
>> >> wrote:
>> >> > On Thu, Dec 29, 2011 at 1:52 PM, Sean Wolfe <ether.joe@xxxxxxxxx>
>> >> > wrote:
>> >> >>
>> >> >> frames = [image1, image2, image3]
>> >> >> running = True
>> >> >> while running:
>> >> >>    for event in pygame.event.get():
>> >> >>        if event.type == MOUSEBUTTONDOWN:
>> >> >>            clock.tick(10)
>> >> >>            for img in frames:
>> >> >>                screen.blit(background, (0,0))
>> >> >>                screen.blit(img, position)
>> >> >>                pygame.display.flip()
>> >> >>                clock.tick(10)
>> >> >
>> >> > You do realize that you're only ever drawing when the mouse is
>> >> > pressed,
>> >> > right?  So, you'll have to click for every frame.
>> >> >
>> >> > Also, you're drawing every frame in the animation on top of each
>> >> > other.
>> >> >
>> >> > Ian
>> >>
>> >>
>> >>
>> >> --
>> >> A musician must make music, an artist must paint, a poet must write,
>> >> if he is to be ultimately at peace with himself.
>> >> - Abraham Maslow
>> >
>> >
>>
>>
>>
>> --
>> A musician must make music, an artist must paint, a poet must write,
>> if he is to be ultimately at peace with himself.
>> - Abraham Maslow
>
>



-- 
A musician must make music, an artist must paint, a poet must write,
if he is to be ultimately at peace with himself.
- Abraham Maslow