Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix weeby integration #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import communityart;
//import communityart;
import effects;

import entities.shapes.Line as Line;
Expand Down Expand Up @@ -103,7 +103,8 @@ exports = {

setTimeout(function () {
if (this.weebyData) {
weeby.finishGame({ score: this.getScore() });
this.weeby.finishGame({ score: this.getScore() });
scene.mode('weeby');
} else {
if (!opts.noGameoverScreen) {
var bgHeight = this.screen.height;
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var scene = window.scene = function (newGameFunc) {
scene._appClass = Class(GC.Application, function(supr) {
this.init = function() {
supr(this, 'init', arguments);
scene.app = this;
scene.app = this.rootView;

var internalGame = scene.internal.game;

Expand Down Expand Up @@ -53,6 +53,7 @@ var SCENE_MODULES = [
scene.log = new Logger('scene', SCENE_CONFIG.logging.scene);
scene.log.log('Logging now ready');
scene.performance = performance;
scene.weeby = weeby;

// // Module Registration // //

Expand Down
2 changes: 1 addition & 1 deletion src/utils/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var TrackerInstance = Class(function() {
var PerformanceTracker = Class(function() {

this.DO_TRACKING = SCENE_CONFIG.performance;
this.now = window.performance.now ? window.performance.now.bind(window.performance) : Date.now;
this.now = window.performance && window.performance.now ? window.performance.now.bind(window.performance) : Date.now;

this.init = function() {
this.tracking = {};
Expand Down
13 changes: 9 additions & 4 deletions src/weeby/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
*/
var useWeeby = function() {
import weeby;
this.weeby = weeby;

var _gameView;
function getGameView() {
return _gameView || (_gameView = weeby.createGameView(GC.app));
}

this.mode('weeby', function () {

});

GC.on('app', function () {
weeby.launchUI();
weeby.onStartGame = function (data) {
scene.weebyData = data;
scene.mode('default');
scene.internal.game.reset();
};
});

GC.on('app', function () {
scene.mode('weeby');
});

Expand All @@ -37,5 +40,7 @@ exports = {
* Data from the weeby library, if it is being used, otherwise null
* @type {Object}
*/
weebyData: null
weebyData: null,

weeby: null
};