Export to GitHub

cakejs - issue #3

Only redraw when scene changed (automatically!)


Posted on Mar 12, 2008 by Helpful Kangaroo

CAKE redraws the canvas on every frame, even if the scene hasn't changed between frames. This causes a lot of useless CPU use.

The way that the redrawOnlyWhenChanged -flag works is very manual, a better way to do it would be to store the previous frame state and compare it to the current state in the update-phase.

Using setters (defined in CanvasNode#initialize) would work for a limited set of operations (that is, changing state through assignment.) Comparing frame states would be less fragile.

Comment #1

Posted on Mar 12, 2008 by Helpful Kangaroo

(No comment was entered for this change.)

Comment #2

Posted on Mar 21, 2008 by Helpful Kangaroo

Made animators and append/remove set the changed-flag, propagating flag up in handleUpdate.

If you use animators and remember to set this.changed in event listeners, everything should work ok.

Status: Started

Labels:
Type-Enhancement Priority-Medium