Skip to content

Commit

Permalink
some bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
splhack committed Jun 6, 2013
1 parent 33e0f45 commit 222ad0e
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 61 deletions.
13 changes: 9 additions & 4 deletions coffee/core/lwf_core.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class LWF
@lwfInstanceId = null
@frameRate = @data.header.frameRate
@active = true
@frameSkip = true
@execLimit = 3
@tick = 1.0 / @frameRate
@roundOffTick = @tick * ROUND_OFF_TICK_RATE
Expand Down Expand Up @@ -250,6 +251,7 @@ class LWF
@rootMovie.exec()
@rootMovie.postExec(progressing)
execed = true
break unless @frameSkip

if @progress < @roundOffTick
@progress = 0
Expand Down Expand Up @@ -742,10 +744,13 @@ class LWF

setInteractive: ->
@interactive = true
lwf = @
while lwf.parent?
lwf = lwf.parent.lwf
lwf.interactive = true
@parent.lwf.setInteractive() if @parent?
return

setFrameSkip:(frameSkip) ->
@frameSkip = frameSkip
@progress = 0
@parent.lwf.setFrameSkip(frameSkip) if @parent?
return

getMovieFunctions:(movieId) ->
Expand Down
1 change: 1 addition & 0 deletions coffee/core/lwf_expose.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ LWF.prototype["setButtonEventListener"] = LWF.prototype.setButtonEventHandler
LWF.prototype["setEventHandler"] = LWF.prototype.setEventHandler
LWF.prototype["setEventListener"] = LWF.prototype.setEventHandler
LWF.prototype["setFrameRate"] = LWF.prototype.setFrameRate
LWF.prototype["setFrameSkip"] = LWF.prototype.setFrameSkip
LWF.prototype["setMovieCommand"] = LWF.prototype.setMovieCommand
LWF.prototype["setMovieEventHandler"] = LWF.prototype.setMovieEventHandler
LWF.prototype["setMovieEventListener"] = LWF.prototype.setMovieEventHandler
Expand Down
1 change: 0 additions & 1 deletion coffee/core/lwf_graphic.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Graphic extends LObject
return

render:(v, rOffset) ->
return unless v
obj.render(v, rOffset) for obj in @displayList
return

Expand Down
6 changes: 5 additions & 1 deletion coffee/core/lwf_movie.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ class Movie extends IObject
execDetachHandler:(lwfContainer) ->
lwf = lwfContainer.child
if lwf.detachHandler?
lwf.destroy() if lwf.detachHandler(lwf)
if lwf.detachHandler(lwf)
lwf.destroy()
else
lwf.setAttachVisible(false)
lwf.render()
else
lwf.destroy()
lwf.parent = null
Expand Down
8 changes: 4 additions & 4 deletions coffee/js/lwf.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions coffee/js/lwf_cocos2d.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions coffee/js/lwf_webgl.js

Large diffs are not rendered by default.

31 changes: 21 additions & 10 deletions coffee/js_debug/lwf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,9 +2354,6 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
Graphic.prototype.render = function(v, rOffset) {
var obj, _i, _len, _ref1;

if (!v) {
return;
}
_ref1 = this.displayList;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
obj = _ref1[_i];
Expand Down Expand Up @@ -3408,6 +3405,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
if (lwf.detachHandler != null) {
if (lwf.detachHandler(lwf)) {
lwf.destroy();
} else {
lwf.setAttachVisible(false);
lwf.render();
}
} else {
lwf.destroy();
Expand Down Expand Up @@ -4882,6 +4882,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.lwfInstanceId = null;
this.frameRate = this.data.header.frameRate;
this.active = true;
this.frameSkip = true;
this.execLimit = 3;
this.tick = 1.0 / this.frameRate;
this.roundOffTick = this.tick * ROUND_OFF_TICK_RATE;
Expand Down Expand Up @@ -5147,6 +5148,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.rootMovie.exec();
this.rootMovie.postExec(progressing);
execed = true;
if (!this.frameSkip) {
break;
}
}
if (this.progress < this.roundOffTick) {
this.progress = 0;
Expand Down Expand Up @@ -5986,13 +5990,17 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
};

LWF.prototype.setInteractive = function() {
var lwf;

this.interactive = true;
lwf = this;
while (lwf.parent != null) {
lwf = lwf.parent.lwf;
lwf.interactive = true;
if (this.parent != null) {
this.parent.lwf.setInteractive();
}
};

LWF.prototype.setFrameSkip = function(frameSkip) {
this.frameSkip = frameSkip;
this.progress = 0;
if (this.parent != null) {
this.parent.lwf.setFrameSkip(frameSkip);
}
};

Expand Down Expand Up @@ -6343,6 +6351,8 @@ if (typeof global === "undefined" && typeof window !== "undefined") {

LWF.prototype["setFrameRate"] = LWF.prototype.setFrameRate;

LWF.prototype["setFrameSkip"] = LWF.prototype.setFrameSkip;

LWF.prototype["setMovieCommand"] = LWF.prototype.setMovieCommand;

LWF.prototype["setMovieEventHandler"] = LWF.prototype.setMovieEventHandler;
Expand Down Expand Up @@ -7657,6 +7667,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
function WebkitCSSResourceCache() {
this.cache = {};
this.lwfInstanceIndex = 0;
this.canvasIndex = 0;
}

WebkitCSSResourceCache.prototype.clear = function() {
Expand Down Expand Up @@ -8126,7 +8137,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
var canvas, ctx, name;

if (this.constructor === WebkitCSSResourceCache) {
name = "canvas_" + filename.replace(/[\.,-]/g, "_");
name = "canvas_" + ++this.canvasIndex;
ctx = document.getCSSCanvasContext("2d", name, w, h);
canvas = ctx.canvas;
canvas.name = name;
Expand Down
31 changes: 21 additions & 10 deletions coffee/js_debug/lwf_cocos2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,9 +2354,6 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
Graphic.prototype.render = function(v, rOffset) {
var obj, _i, _len, _ref1;

if (!v) {
return;
}
_ref1 = this.displayList;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
obj = _ref1[_i];
Expand Down Expand Up @@ -3408,6 +3405,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
if (lwf.detachHandler != null) {
if (lwf.detachHandler(lwf)) {
lwf.destroy();
} else {
lwf.setAttachVisible(false);
lwf.render();
}
} else {
lwf.destroy();
Expand Down Expand Up @@ -4882,6 +4882,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.lwfInstanceId = null;
this.frameRate = this.data.header.frameRate;
this.active = true;
this.frameSkip = true;
this.execLimit = 3;
this.tick = 1.0 / this.frameRate;
this.roundOffTick = this.tick * ROUND_OFF_TICK_RATE;
Expand Down Expand Up @@ -5147,6 +5148,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.rootMovie.exec();
this.rootMovie.postExec(progressing);
execed = true;
if (!this.frameSkip) {
break;
}
}
if (this.progress < this.roundOffTick) {
this.progress = 0;
Expand Down Expand Up @@ -5986,13 +5990,17 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
};

LWF.prototype.setInteractive = function() {
var lwf;

this.interactive = true;
lwf = this;
while (lwf.parent != null) {
lwf = lwf.parent.lwf;
lwf.interactive = true;
if (this.parent != null) {
this.parent.lwf.setInteractive();
}
};

LWF.prototype.setFrameSkip = function(frameSkip) {
this.frameSkip = frameSkip;
this.progress = 0;
if (this.parent != null) {
this.parent.lwf.setFrameSkip(frameSkip);
}
};

Expand Down Expand Up @@ -6343,6 +6351,8 @@ if (typeof global === "undefined" && typeof window !== "undefined") {

LWF.prototype["setFrameRate"] = LWF.prototype.setFrameRate;

LWF.prototype["setFrameSkip"] = LWF.prototype.setFrameSkip;

LWF.prototype["setMovieCommand"] = LWF.prototype.setMovieCommand;

LWF.prototype["setMovieEventHandler"] = LWF.prototype.setMovieEventHandler;
Expand Down Expand Up @@ -6578,6 +6588,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
function WebkitCSSResourceCache() {
this.cache = {};
this.lwfInstanceIndex = 0;
this.canvasIndex = 0;
}

WebkitCSSResourceCache.prototype.clear = function() {
Expand Down Expand Up @@ -7047,7 +7058,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
var canvas, ctx, name;

if (this.constructor === WebkitCSSResourceCache) {
name = "canvas_" + filename.replace(/[\.,-]/g, "_");
name = "canvas_" + ++this.canvasIndex;
ctx = document.getCSSCanvasContext("2d", name, w, h);
canvas = ctx.canvas;
canvas.name = name;
Expand Down
31 changes: 21 additions & 10 deletions coffee/js_debug/lwf_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,9 +2354,6 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
Graphic.prototype.render = function(v, rOffset) {
var obj, _i, _len, _ref1;

if (!v) {
return;
}
_ref1 = this.displayList;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
obj = _ref1[_i];
Expand Down Expand Up @@ -3408,6 +3405,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
if (lwf.detachHandler != null) {
if (lwf.detachHandler(lwf)) {
lwf.destroy();
} else {
lwf.setAttachVisible(false);
lwf.render();
}
} else {
lwf.destroy();
Expand Down Expand Up @@ -4882,6 +4882,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.lwfInstanceId = null;
this.frameRate = this.data.header.frameRate;
this.active = true;
this.frameSkip = true;
this.execLimit = 3;
this.tick = 1.0 / this.frameRate;
this.roundOffTick = this.tick * ROUND_OFF_TICK_RATE;
Expand Down Expand Up @@ -5147,6 +5148,9 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
this.rootMovie.exec();
this.rootMovie.postExec(progressing);
execed = true;
if (!this.frameSkip) {
break;
}
}
if (this.progress < this.roundOffTick) {
this.progress = 0;
Expand Down Expand Up @@ -5986,13 +5990,17 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
};

LWF.prototype.setInteractive = function() {
var lwf;

this.interactive = true;
lwf = this;
while (lwf.parent != null) {
lwf = lwf.parent.lwf;
lwf.interactive = true;
if (this.parent != null) {
this.parent.lwf.setInteractive();
}
};

LWF.prototype.setFrameSkip = function(frameSkip) {
this.frameSkip = frameSkip;
this.progress = 0;
if (this.parent != null) {
this.parent.lwf.setFrameSkip(frameSkip);
}
};

Expand Down Expand Up @@ -6343,6 +6351,8 @@ if (typeof global === "undefined" && typeof window !== "undefined") {

LWF.prototype["setFrameRate"] = LWF.prototype.setFrameRate;

LWF.prototype["setFrameSkip"] = LWF.prototype.setFrameSkip;

LWF.prototype["setMovieCommand"] = LWF.prototype.setMovieCommand;

LWF.prototype["setMovieEventHandler"] = LWF.prototype.setMovieEventHandler;
Expand Down Expand Up @@ -7111,6 +7121,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
function WebkitCSSResourceCache() {
this.cache = {};
this.lwfInstanceIndex = 0;
this.canvasIndex = 0;
}

WebkitCSSResourceCache.prototype.clear = function() {
Expand Down Expand Up @@ -7580,7 +7591,7 @@ if (typeof global === "undefined" && typeof window !== "undefined") {
var canvas, ctx, name;

if (this.constructor === WebkitCSSResourceCache) {
name = "canvas_" + filename.replace(/[\.,-]/g, "_");
name = "canvas_" + ++this.canvasIndex;
ctx = document.getCSSCanvasContext("2d", name, w, h);
canvas = ctx.canvas;
canvas.name = name;
Expand Down
3 changes: 2 additions & 1 deletion coffee/webkitcss/lwf_webkitcss_resourcecache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WebkitCSSResourceCache
constructor: ->
@cache = {}
@lwfInstanceIndex = 0
@canvasIndex = 0

clear: ->
for k, cache of @cache
Expand Down Expand Up @@ -392,7 +393,7 @@ class WebkitCSSResourceCache

createCanvas:(filename, w, h) ->
if @.constructor is WebkitCSSResourceCache
name = "canvas_" + filename.replace(/[\.,-]/g, "_")
name = "canvas_" + ++@canvasIndex
ctx = document.getCSSCanvasContext("2d", name, w, h)
canvas = ctx.canvas
canvas.name = name
Expand Down
Loading

0 comments on commit 222ad0e

Please sign in to comment.