add inited event for Game

This commit is contained in:
Jare Guo
2016-04-19 14:11:10 +08:00
parent c79dba6251
commit 0675a9fc8e
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -39,6 +39,7 @@ var game = /** @lends cc.game# */{
EVENT_HIDE: "game_on_hide",
EVENT_SHOW: "game_on_show",
EVENT_RESIZE: "game_on_resize",
EVENT_GAME_INITED: "game_inited",
EVENT_RENDERER_INITED: "renderer_inited",
RENDER_TYPE_CANVAS: 0,
@@ -336,10 +337,12 @@ var game = /** @lends cc.game# */{
cc.loader.load(jsList, function (err) {
if (err) throw new Error(JSON.stringify(err));
self._prepared = true;
self.emit(self.EVENT_GAME_INITED);
if (cb) cb();
});
}
else {
self.emit(self.EVENT_GAME_INITED);
if (cb) cb();
}
+4
View File
@@ -40,6 +40,8 @@ cc.js.mixin(cc.game, {
RENDER_TYPE_CANVAS: 0,
RENDER_TYPE_WEBGL: 1,
RENDER_TYPE_OPENGL: 2,
EVENT_GAME_INITED: "game_inited",
CONFIG_KEY: {
width: 'width',
@@ -105,10 +107,12 @@ cc.js.mixin(cc.game, {
cc.loader.load(jsList, function (err) {
if (err) throw new Error(JSON.stringify(err));
self._prepared = true;
self.emit(self.EVENT_GAME_INITED);
if (cb) cb();
});
}
else {
self.emit(self.EVENT_GAME_INITED);
if (cb) cb();
}