Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhitman <bryan@olenepal.org>2009-09-12 07:21:30 (GMT)
committer hitman <bryan@olenepal.org>2009-09-12 07:21:30 (GMT)
commitb0913303e8d049884d054826d5296ef09c486b58 (patch)
tree10390fa69df9cfafdeb08978dbae9efa84878a3d
parent62743c2670ac7a9d20a530848004dc51429fc523 (diff)
changed id property for images, sounds, and surfaces to name
instead. Did this to avoid confusion with an html element's ID attribute.
-rwxr-xr-x[-rw-r--r--]examples/adding_up_to_10/assets/es-MX/sounds/es-MX_correct.oggbin14432 -> 14432 bytes
-rwxr-xr-x[-rw-r--r--]examples/adding_up_to_10/assets/es-MX/sounds/es-MX_incorrect.oggbin13705 -> 13705 bytes
-rwxr-xr-xexamples/adding_up_to_10/js/lesson.js55
-rwxr-xr-xjs/jquery.karma.js30
4 files changed, 45 insertions, 40 deletions
diff --git a/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_correct.ogg b/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_correct.ogg
index a54f738..a54f738 100644..100755
--- a/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_correct.ogg
+++ b/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_correct.ogg
Binary files differ
diff --git a/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_incorrect.ogg b/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_incorrect.ogg
index 0474b93..0474b93 100644..100755
--- a/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_incorrect.ogg
+++ b/examples/adding_up_to_10/assets/es-MX/sounds/es-MX_incorrect.ogg
Binary files differ
diff --git a/examples/adding_up_to_10/js/lesson.js b/examples/adding_up_to_10/js/lesson.js
index 7ae5881..852bd3f 100755
--- a/examples/adding_up_to_10/js/lesson.js
+++ b/examples/adding_up_to_10/js/lesson.js
@@ -5,38 +5,42 @@ $(document).ready(function(){
k.init({
images: [
- {id: "ball", file: "ball37px.png", localized : false },
- {id: "balloon", file: "balloon37px.png", localized : false },
- {id: "banana", file: "banana37px.png", localized : false },
- {id: "chilli", file: "chilli.png", localized : false },
- {id: "fish" , file: "fish64px.png", localized : false },
- {id: "flower", file: "flower37px.png", localized : false },
- {id: "normalChimp", file: "normalChimp_120x125.png", localized : false},
- {id: "happyChimp", file: "happyChimp_120x125.png", localized: false},
- {id: "sadChimp", file: "sadChimp_120x125.png", localized : false}
+ {name: "ball", file: "ball37px.png", localized : false },
+ {name: "balloon", file: "balloon37px.png", localized : false },
+ {name: "banana", file: "banana37px.png", localized : false },
+ {name: "chilli", file: "chilli.png", localized : false },
+ {name: "fish" , file: "fish64px.png", localized : false },
+ {name: "flower", file: "flower37px.png", localized : false },
+ {name: "normalChimp", file: "normalChimp_120x125.png", localized : false},
+ {name: "happyChimp", file: "happyChimp_120x125.png", localized: false},
+ {name: "sadChimp", file: "sadChimp_120x125.png", localized : false}
+
]
,
sounds: [
- {id: "correct", file: "correct.ogg"},
- {id: "incorrect", file: "incorrect.ogg"},
- {id: "trigger", file: "trigger.ogg", localized: false}
-
+
+ {name: "correct", file: "correct.ogg"},
+ {name: "incorrect", file: "incorrect.ogg"},
+ {name: "trigger", file: "trigger.ogg", localized: false}
+
],
surfaces: [
- {id:"topLt", canvas:"topLtCanvas"},
- {id:"topRt", canvas:"topRtCanvas"},
- {id:"bottomLt", canvas:"bottomLtCanvas"},
- {id:"bottomMd", canvas:"bottomMdCanvas"},
- {id:"bottomRt", canvas:"bottomRtCanvas"},
- {id:"timer", canvas:"timerCanvas"},
- {id:"scorebox", canvas:"scoreboxCanvas"},
- {id:"chimp", canvas:"chimpCanvas"}
+ {name:"topLt", canvas:"topLtCanvas"},
+ {name:"topRt", canvas:"topRtCanvas"},
+ {name:"bottomLt", canvas:"bottomLtCanvas"},
+ {name:"bottomMd", canvas:"bottomMdCanvas"},
+ {name:"bottomRt", canvas:"bottomRtCanvas"},
+ {name:"timer", canvas:"timerCanvas"},
+ {name:"scorebox", canvas:"scoreboxCanvas"},
+ {name:"chimp", canvas:"chimpCanvas"}
- ]
+]
});
+
k.main(function() {
+
var imgNames = ["ball", "banana", "balloon","chilli", "fish", "flower"];
//game logic
var total, level=0, time, n0, n1, correct;
@@ -73,7 +77,7 @@ k.main(function() {
function game () {
$.each(k.surfaces, function () {
- if (this.id != "chimp"){
+ if (this.name != "chimp"){
this.clear();
}
});
@@ -227,7 +231,7 @@ k.main(function() {
score = level = 0;
startTimerY = 10;
$.each(k.surfaces, function () {
- if (this.id != "chimp"){
+ if (this.name != "chimp"){
this.clear();
}
});
@@ -287,8 +291,9 @@ k.main(function() {
k.library.images["normalChimp"].draw(k.surfaces["chimp"], 0, 0);
-
//end of Karma.main
});
+
+
//end of ready
}); \ No newline at end of file
diff --git a/js/jquery.karma.js b/js/jquery.karma.js
index 24dd7ab..504addd 100755
--- a/js/jquery.karma.js
+++ b/js/jquery.karma.js
@@ -323,12 +323,12 @@ var Karma = function(options ) {
/** @memberOf Karma **/
Karma.prototype.surface = function ( options ) {
if ( !valid(options, "object") ){
- var options = { id: "ksurface-"+ (this.surfaces.length + 1 ) };
+ var options = { name: "ksurface-"+ (this.surfaces.length + 1 ) };
}
options.mainContainer = this.container;
options.paths = this.paths;
- this.surfaces[ options.id ] = new KSurface( options );
- return this.surface[ options.id ];
+ this.surfaces[ options.name ] = new KSurface( options );
+ return this.surface[ options.name ];
}
@@ -467,20 +467,20 @@ Karma.prototype.main = function ( cb ) {
for ( var i=0; i < categories.length; i++ ) {
var category = categories[ i ];
- if ( valid ( this.pendingToLoad[ category ] ) ) {
+ if ( valid ( this.pendingToLoad[ category ] ) ) {
//load all the category elements
var type = category.substr( 0, category.length-1 )
$.each (this.pendingToLoad[ category ], function( key, config ){
- var id = config.id;
- delete config.id;
+ var name = config.name;
+ delete config.name;
//register the elements into the library
- that.library[ category ][ id ] = Karma.prototype[ type ](
+ that.library[ category ][ name ] = Karma.prototype[ type ](
config
);
- that.library[ category ][ id ].media.addEventListener(
+ that.library[ category ][ name ].media.addEventListener(
"load",checkAllLoaded,false
);
- that.library[ category ][ id ].media.addEventListener(
+ that.library[ category ][ name ].media.addEventListener(
"error",checkAllLoaded,false
);
});
@@ -601,7 +601,7 @@ var Class = function ( ) {
/**
Creates a new surface
@param {object} options
-@param {string} [options.id]
+@param {string} [options.name]
@param {string | object} [options.container]
@param {number} [width=100]
@param {number} [height=100]
@@ -635,7 +635,7 @@ var KSurface = Class(
var defaultOptions = {
//mainContainer: '',//must be overwritten by Karma.container
- id: '',//must be overwritten by the Karma.surface OR user
+ name: '',//must be overwritten by the Karma.surface OR user
container: '', //must be overwritten by Karma.container OR user
width: 100,
@@ -649,7 +649,7 @@ var KSurface = Class(
this.canvas = document.createElement("canvas");
this.canvas.width = this.width;
this.canvas.height = this.height;
- this.canvas.id = this.id;
+ this.canvas.id = this.name;
this.container.appendChild( this.canvas );
}else {
this.canvas = document.getElementById( options.canvas );
@@ -658,8 +658,8 @@ var KSurface = Class(
}
this.width = this.canvas.width;
this.height = this.canvas.height;
- if (!this.id){
- this.id = this.canvas.id;
+ if (!this.name){
+ this.name = this.canvas.id;
}
}
if ( this.canvas.getContext ) {
@@ -1055,7 +1055,7 @@ var KButton = Class(
if ( valid( options ) ) {
KGraphic.init.call(this, options );
}
- this.id = options.id;
+ this.name = options.name;
master.buttons.push(this);
},
draw : function ( ) {},