diff --git a/compiled/radium.js b/compiled/radium.js index 6a12889..956f5d4 100644 --- a/compiled/radium.js +++ b/compiled/radium.js @@ -1490,12 +1490,14 @@ ResourceManager = (function() { if (finished_callback == null) { finished_callback = (function() {}); } - return this.do_preload(1, (function() {}), finished_callback); + return this.do_preload(1, (function() {}), finished_callback.bind(this)); }; - ResourceManager.prototype.load = function() { - var _ref, _ref1; - return this.do_preload(2, this.updateProgress, (_ref = (_ref1 = this.onLoad) != null ? _ref1.bind(this) : void 0) != null ? _ref : (function() {})); + ResourceManager.prototype.load = function(finished_callback) { + if (finished_callback == null) { + finished_callback = (function() {}); + } + return this.do_preload(2, this.updateProgress, finished_callback.bind(this)); }; return ResourceManager; diff --git a/gemswap/core.coffee b/gemswap/core.coffee index edd93e0..aa109a2 100644 --- a/gemswap/core.coffee +++ b/gemswap/core.coffee @@ -37,7 +37,7 @@ $(-> engine.setPreloadScene(engine.createScene("loader")) engine.setInitialScene(engine.createScene("main")) - manager.onLoad = -> + manager.load -> # Game asset initialization... engine.createSprite("cursor", "images/cursor.png") @@ -112,7 +112,5 @@ $(-> # Let's go! engine.start() - - manager.load() ) diff --git a/gemswap/gemswap.js b/gemswap/gemswap.js index b4da8e8..c72ef0d 100644 --- a/gemswap/gemswap.js +++ b/gemswap/gemswap.js @@ -22,7 +22,7 @@ engine.addCanvas($("#gamecanvas")); engine.setPreloadScene(engine.createScene("loader")); engine.setInitialScene(engine.createScene("main")); - manager.onLoad = function() { + return manager.load(function() { var cursor, diamond; engine.createSprite("cursor", "images/cursor.png"); engine.createSprite("diamond", "images/diamond.png"); @@ -98,8 +98,7 @@ return _results; }; return engine.start(); - }; - return manager.load(); + }); }); }); })(); \ No newline at end of file diff --git a/radium/resource-manager.coffee b/radium/resource-manager.coffee index ef94d61..9f6d6a9 100644 --- a/radium/resource-manager.coffee +++ b/radium/resource-manager.coffee @@ -81,9 +81,9 @@ class ResourceManager prepare: (finished_callback = (->)) => # This performs a stage 1 preload, loading the initial assets required for displaying the preload screen. - @do_preload(1, (->), finished_callback) + @do_preload(1, (->), finished_callback.bind(this)) - load: () => + load: (finished_callback = (->)) => # This performs the stage 2 preload; it will load the actual game assets. - @do_preload(2, @updateProgress, @onLoad?.bind(this) ? (->)) + @do_preload(2, @updateProgress, finished_callback.bind(this)) \ No newline at end of file