1 | "use strict";
|
2 |
|
3 | var Scene = require("./scene");
|
4 |
|
5 | module.exports = function(canvas, percentLoaded, nextScene) {
|
6 | var scene = new Scene();
|
7 | scene.renderer.add(function(entities, context) {
|
8 | context.fillStyle = "#000000";
|
9 | context.fillRect(0, 0, canvas.width, canvas.height);
|
10 |
|
11 | var quarterWidth = Math.floor(canvas.width / 4);
|
12 | var halfWidth = Math.floor(canvas.width / 2);
|
13 | var halfHeight = Math.floor(canvas.height / 2);
|
14 |
|
15 | context.fillStyle = "#ffffff";
|
16 | context.fillRect(quarterWidth, halfHeight - 15, halfWidth, 30);
|
17 |
|
18 | context.fillStyle = "#000000";
|
19 | context.fillRect(quarterWidth + 3, halfHeight - 12, halfWidth - 6, 24);
|
20 |
|
21 | context.fillStyle = "#ffffff";
|
22 | var barWidth = (halfWidth - 6) * percentLoaded();
|
23 | context.fillRect(quarterWidth + 3, halfHeight - 12, barWidth, 24);
|
24 |
|
25 | if (percentLoaded() === 1) {
|
26 | scene.stop();
|
27 | nextScene.start(context);
|
28 | }
|
29 | });
|
30 | return scene;
|
31 | };
|