Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/js/activity.js
blob: 28ff10a0b0ad93a22693715bbd72be969bbc2c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
define(function (require) {
    "use strict";
    
    var activity = require('sugar-web/activity/activity'),
        createjs = require('easel'),
        Tween = require('tween'),
        $ = require('jquery');

    // Manipulate the DOM only when it is ready.
    require(['domReady!'], function (doc) {
        
        // Initialize the activity.
        activity.setup();
        
        var canvas = doc.getElementById('gameZone'),
            stage = new createjs.Stage(canvas),
            toolbar_height = $('.toolbar').height(),
            win_dim = new Array($(window).width(), $(window).height()),
            gameZone_dim = new Array(win_dim[0], win_dim[1]-toolbar_height);
        /*
        I assume that we won't draw outside game zone.
        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 text = new createjs.Text("Size is "+gameZone_dim[0]+" x "+gameZone_dim[1], "16px Arial", "#000"),
            background = new createjs.Shape();
        
        background.graphics.beginFill("#F00").drawRect(0, 0, gameZone_dim[0], gameZone_dim[1]);
        
        var test_picture = new createjs.Bitmap("../activity/activity-icon.svg");
        
        stage.addChild(background);
        stage.addChild(text);
        
        stage.addChild(test_picture);
        
        stage.update();

    });

});