Various fixes for Cocos2d

This commit is contained in:
Florian Rival
2016-03-02 11:38:50 +01:00
parent d54eadf39d
commit 246bde6dec
4 changed files with 10 additions and 4 deletions

View File

@@ -12,5 +12,5 @@ gdjs.LoadingScreenCocosRenderer = function(runtimeGamePixiRenderer)
gdjs.LoadingScreenRenderer = gdjs.LoadingScreenCocosRenderer; //Register the class to let the engine use it. gdjs.LoadingScreenRenderer = gdjs.LoadingScreenCocosRenderer; //Register the class to let the engine use it.
gdjs.LoadingScreenCocosRenderer.prototype.render = function(percent) { gdjs.LoadingScreenCocosRenderer.prototype.render = function(percent) {
console.log("Loading", percent); console.log("Loading " + percent + "%");
}; };

View File

@@ -104,7 +104,9 @@ gdjs.SpriteRuntimeObjectCocosRenderer.prototype.setColor = function(rgbColor) {
var colors = rgbColor.split(";"); var colors = rgbColor.split(";");
if ( colors.length < 3 ) return; if ( colors.length < 3 ) return;
this._sprite.setColor(parseInt(colors[0]), parseInt(colors[1]), parseInt(colors[2])); this._sprite.setColor(cc.color(
parseInt(colors[0]), parseInt(colors[1]), parseInt(colors[2]))
);
}; };
gdjs.SpriteRuntimeObjectCocosRenderer.prototype.getWidth = function() { gdjs.SpriteRuntimeObjectCocosRenderer.prototype.getWidth = function() {

View File

@@ -208,3 +208,7 @@ Array.prototype.createFrom = function(arr) {
} }
} }
}; };
//Make sure console.warn and console.error are available.
console.warn = console.warn || console.log;
console.error = console.error || console.log;

View File

@@ -262,7 +262,7 @@ gdjs.SoundManager.prototype.preloadAudio = function(onProgress, onComplete, reso
var loaded = 0; var loaded = 0;
function onLoad(audioFile) { function onLoad(audioFile) {
console.log("loaded", audioFile); console.log("loaded" + audioFile);
loaded++; loaded++;
if (loaded === files.length) { if (loaded === files.length) {
console.log("All audio loaded"); console.log("All audio loaded");
@@ -275,7 +275,7 @@ gdjs.SoundManager.prototype.preloadAudio = function(onProgress, onComplete, reso
for(var i = 0;i<files.length;++i) { for(var i = 0;i<files.length;++i) {
(function(audioFile) { (function(audioFile) {
console.log("Loading", audioFile) console.log("Loading" + audioFile)
var sound = new Howl({ var sound = new Howl({
src: [audioFile], //TODO: ogg, mp3... src: [audioFile], //TODO: ogg, mp3...
preload: true, preload: true,