Anonymous avatar Anonymous committed ce940c0

add basic HUD message system

Comments (0)

Files changed (3)

 }
 
 #game {
+    position:relative;
     width:980px;
     height:370px;
     border:5px solid block;
     border: 5px solid rgb(100,100,100);
 }
 
+#hud {
+    position: absolute;
+    top:7px;
+    left:0px;
+    width: 990px;
+    height: 375px;
+    z-index: 100;
+    font-family: Tahoma, sans-serif;
+    line-height: 375px;
+    color: #fff9d6;
+    font-weight:bold;
+    font-size: 134px;
+    text-align: center;
+}
+
 .floating {
     float: left;
 }
 </head>
 <body>
     <div id="game">
+        <div id="hud">loading...</div>
         <div class="canvasContainer">
             <canvas id="2space" width=480 height=360></canvas>
             <div class="overlay"></div>
     './display2d',
     './space2d',
     './editor2d',
-    './levels'],
+    './levels','./hud'],
 
-function(createjs, video, display3d, space3d, display2d, space2d, editor2d, levels) {
+function(createjs, video, display3d, space3d, display2d, space2d, editor2d, levels, hud) {
 
     var scheduledEvent = {
         frames: 0,
     space3d.setObjectiveDelegate( objectiveHandler );
 
     var go = function() {
+        hud.hide();
         space3d.onWarpHoleState( space2d.setWarpHoleState );
         space2d.onBallWarped( space3d.addBall );
 
         next();
     }
 
+    hud.setMessage("authorize camera.");
     video.videoCamera.waitForAuthorization( go );
 });
+"use strict";
+
+define([],function() {
+    var setMessage = function(message) {
+        var element = document.getElementById("hud");
+        element.innerHTML = message;
+    }
+
+    var hide = function() {
+        var element = document.getElementById("hud");
+        element.style.visibility = 'hidden';
+    }
+
+    var show = function() {
+        var element = document.getElementById("hud");
+        element.style.visibility = 'visible';
+    }
+
+    return {
+        setMessage:setMessage,
+        show: show,
+        hide: hide
+    }
+});
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.