Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/js/activity.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/activity.js')
-rw-r--r--js/activity.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/js/activity.js b/js/activity.js
index 28ff10a..805861a 100644
--- a/js/activity.js
+++ b/js/activity.js
@@ -4,6 +4,7 @@ define(function (require) {
var activity = require('sugar-web/activity/activity'),
createjs = require('easel'),
Tween = require('tween'),
+ Preload = require('preload'),
$ = require('jquery');
// Manipulate the DOM only when it is ready.
@@ -22,21 +23,29 @@ define(function (require) {
Removing overflow, even auto, remove size overhead, so that the background is applied to the whole game zone area.
*/
$("#canvas").css("overflow", "hidden");
- $("#gameZone").width(gameZone_dim[0]);
- $("#gameZone").height(gameZone_dim[1]);
+ var canvasContext = $("#gameZone")[0].getContext("2d");
+ canvasContext.canvas.width = gameZone_dim[0];
+ canvasContext.canvas.height = gameZone_dim[1];
- var text = new createjs.Text("Size is "+gameZone_dim[0]+" x "+gameZone_dim[1], "16px Arial", "#000"),
- background = new createjs.Shape();
+ // Builds the background
+ var background = new createjs.Shape();
+ background.graphics.beginFill("#CCC").drawRect(0, 0, gameZone_dim[0], gameZone_dim[1]);
- background.graphics.beginFill("#F00").drawRect(0, 0, gameZone_dim[0], gameZone_dim[1]);
+ var loadingQueue = new createjs.LoadQueue(false);
+ loadingQueue.on("complete", handleLoadingComplete);
+ loadingQueue.loadManifest([
+ {id:"wb", src:"../pictures/wb.png"}
+ ]);
- var test_picture = new createjs.Bitmap("../activity/activity-icon.svg");
+ function handleLoadingComplete(){
+ console.log("loaded image");
+ var image = loadingQueue.getResult("wb").result;
+ stage.addChild(new createjs.Bitmap(image));
+ stage.update();
+ }
- stage.addChild(background);
- stage.addChild(text);
-
- stage.addChild(test_picture);
+ stage.addChild(background);
stage.update();
});