Author: duncan
Date: Wed Feb 20 16:44:55 2008
New Revision: 10399
Log:
Merging rel-1 and rel-1 differences
Modified:
branches/rel-1-7/freevo/src/animation/base.py
branches/rel-1-7/freevo/src/animation/render.py
branches/rel-1-7/freevo/src/animation/transition.py
branches/rel-1/freevo/src/animation/base.py
Modified: branches/rel-1-7/freevo/src/animation/base.py
==============================================================================
--- branches/rel-1-7/freevo/src/animation/base.py (original)
+++ branches/rel-1-7/freevo/src/animation/base.py Wed Feb 20 16:44:55 2008
@@ -54,16 +54,16 @@
next_update = 0 # timestamp for next update
- def __init__(self, rectstyle, fps=20, bg_update=True,
- bg_wait=False, bg_redraw=False):
+ def __init__(self, rectstyle, fps=20, bg_update=True, bg_wait=False,
bg_redraw=False):
+ _debug_('__init__(rectstyle=%r, fps=%r, bg_update=%r, bg_wait=%r,
bg_redraw=%r)' % \
+ (rectstyle, fps, bg_update, bg_wait, bg_redraw), 2)
self.rect = Rect(rectstyle)
self.bg_update = bg_update
self.bg_wait = bg_wait
self.bg_redraw = bg_redraw
- self.surface = Surface( (self.rect.width,
- self.rect.height)).convert()
+ self.surface = Surface((self.rect.width, self.rect.height)).convert()
self.set_fps(fps)
@@ -72,6 +72,7 @@
"""
Helper for creating surfaces
"""
+ _debug_('get_surface(width=%r, height=%r)' % (width, height), 2)
return Surface( (width, height), 0, 32)
@@ -79,6 +80,7 @@
"""
Helper for getting osd singleton
"""
+ _debug_('get_osd()', 2)
return osd.get_singleton()
@@ -86,6 +88,7 @@
"""
Sets the desired fps
"""
+ _debug_('set_fps(fps=%r)' % (fps), 2)
self.interval = int(1000.0/float(fps))
@@ -93,6 +96,7 @@
"""
Update the background
"""
+ _debug_('set_screen_background()', 2)
if not self.background:
self.background = osd.get_singleton().getsurface(rect=self.rect)
self.updates = []
@@ -121,6 +125,7 @@
def get_rect(self):
+ _debug_('get_rect()', 2)
return self.rect
@@ -128,6 +133,7 @@
"""
Starts the animation
"""
+ _debug_('start()', 2)
render.get_singleton().add_animation(self)
if not self.bg_wait:
self.active = True
@@ -137,6 +143,7 @@
"""
Stops the animation from being polled
"""
+ _debug_('stop()', 2)
self.active = False
@@ -144,14 +151,13 @@
"""
Flags the animation to be removed from the animation list
"""
+ _debug_('remove()', 2)
self.active = False
# set the org. bg if we use this
if self.bg_update:
- osd.get_singleton().putsurface(self.background,
- self.rect.left,
- self.rect.top)
- osd.get_singleton().update( [self.rect] )
+ osd.get_singleton().putsurface(self.background, self.rect.left,
self.rect.top)
+ osd.get_singleton().update([self.rect])
self.delete = True
@@ -160,11 +166,10 @@
"""
Checks if the screen background has been damaged
- @note If the rect passed damages our rect, but no actual blit is done
- on osd.screen, we'll end up with a copy of our animation in our bg.
- This is BAD.
+ @note: If the rect passed damages our rect, but no actual blit is done
+ on osd.screen, we'll end up with a copy of our animation in our bg.
This is BAD.
"""
-
+ _debug_('damage(rectstyles=%r)' % (rectstyles), 2)
if not (self.bg_redraw or self.bg_update) or rectstyles == None:
return
@@ -181,7 +186,10 @@
def poll(self, current_time):
-
+ """
+ Poll the animations
+ """
+ _debug_('poll(current_time=%r)' % (current_time), 2)
if self.next_update < current_time:
self.next_update = current_time + self.interval
@@ -196,4 +204,5 @@
"""
Overload to do stuff with the surface
"""
+ _debug_('draw()', 2)
pass
Modified: branches/rel-1-7/freevo/src/animation/render.py
==============================================================================
--- branches/rel-1-7/freevo/src/animation/render.py (original)
+++ branches/rel-1-7/freevo/src/animation/render.py Wed Feb 20 16:44:55 2008
@@ -67,10 +67,10 @@
"""
This class/interface handles updating animation sprites
- @problems How to do everything correctly so we don't end up with garbled
+ @note: How to do everything correctly so we don't end up with garbled
screens. Currently there's probably tons of problems with this.
- @notes Perhaps we should utilize spritegroups for this, as it is supposed
+ @note: Perhaps we should utilize spritegroups for this, as it is supposed
to be optimized for this kind of stuff - pluss we get alot of code for
free.
(ex. RenderUpdates). All animations objects would need to extend the
pygame.sprite.Sprite object.
Modified: branches/rel-1-7/freevo/src/animation/transition.py
==============================================================================
--- branches/rel-1-7/freevo/src/animation/transition.py (original)
+++ branches/rel-1-7/freevo/src/animation/transition.py Wed Feb 20 16:44:55 2008
@@ -55,6 +55,7 @@
@param direction: vertical/horizontal
"""
BaseAnimation.__init__(self, surf1.get_rect(), fps, bg_update=False)
+ _debug_('__init__(surf1=%r, surf2=%r, mode=%r, direction=%r, fps=%r)'
% (surf1, surf2, mode, direction, fps), 2)
self.steps = fps
self.mode = mode
@@ -69,11 +70,11 @@
self.surf_blend1 = surf1.convert()
self.surf_blend2 = surf2.convert()
-
self.prepare()
def prepare(self):
+ _debug_('prepare()', 2)
# random effect
if self.mode == -1:
@@ -117,16 +118,33 @@
def draw(self):
+ _debug_('draw()', 2)
if self.finished:
return
getattr(self, self.drawfuncs[self.mode])()
+ def draw_blend_alpha(self):
+ _debug_('draw_blend_alpha()', 2)
+
+ alpha = self.blend_alphas[self.index_alpha]
+
+ self.surf_blend2.set_alpha(alpha)
+ self.surface.blit(self.surf_blend1, (0, 0))
+ self.surface.blit(self.surf_blend2, (0, 0))
+
+ self.index_alpha += 1
+
+ if self.index_alpha > len(self.blend_alphas) - 1:
+ self.finished = True
+
+
def draw_wipe(self):
"""
Plain wipe
"""
+ _debug_('draw_wipe()', 2)
if self.offset_x > self.rect.width:
self.offset_x = self.rect.width
self.finished = True
@@ -158,7 +176,7 @@
XXX not working!
"""
-
+ _debug_('draw_wipe_alpha()', 2)
if self.line > self.size[0] - 1:
self.finished = True
@@ -197,17 +215,3 @@
self.surface.blit(self.surf_blend1, (0, 0))
self.surface.blit(self.surf_blend2, (0, 0))
-
-
- def draw_blend_alpha(self):
-
- alpha = self.blend_alphas[self.index_alpha]
-
- self.surf_blend2.set_alpha(alpha)
- self.surface.blit(self.surf_blend1, (0, 0))
- self.surface.blit(self.surf_blend2, (0, 0))
-
- self.index_alpha += 1
-
- if self.index_alpha > len(self.blend_alphas) - 1:
- self.finished = True
Modified: branches/rel-1/freevo/src/animation/base.py
==============================================================================
--- branches/rel-1/freevo/src/animation/base.py (original)
+++ branches/rel-1/freevo/src/animation/base.py Wed Feb 20 16:44:55 2008
@@ -33,7 +33,6 @@
import pygame.time
import osd, render
-from kaa import Timer
class BaseAnimation:
"""
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog