Skip to content
Permalink
Newer
Older
100644 33 lines (25 sloc) 894 Bytes
February 8, 2014 21:46
1
var app;
February 14, 2014 23:13
2
var play;
3
var sound;
February 14, 2014 23:13
4
var mouse = {};
February 8, 2014 21:46
5
6
define(function (require) {
7
var activity = require("sugar-web/activity/activity");
8
9
// Manipulate the DOM only when it is ready.
10
require(['domReady!'], function (doc) {
11
12
// Initialize the activity.
13
activity.setup();
February 8, 2014 21:46
14
15
// Save mouse position
16
document.onmousemove = function(e) { mouse.position = {x: e.pageX, y: e.pageY}; }
17
18
// Create sound component
19
sound = new TankOp.Audio();
20
sound.renderInto(document.getElementById("audio"));
21
February 8, 2014 21:46
22
// Launch main screen
23
app = new TankOp.App({activity: activity});
24
app.load();
25
app.renderInto(document.getElementById("board"));
26
27
// Stop sound at end of game to sanitize media environment, specifically on Android
28
document.getElementById("stop-button").addEventListener('click', function (event) {
29
sound.pause();
30
});
31
});
32
33
});