diff webGL/DrumSimulator.html @ 8:040c922bd7ff draft

keyChar -> keyCode,add sounds
author e105711 <yomitan.ie.u-ryukyu.ac.jp>
date Mon, 14 May 2012 16:19:40 +0900
parents c5455ae6cd70
children 502bc41e0c59
line wrap: on
line diff
--- a/webGL/DrumSimulator.html	Sat May 05 23:57:18 2012 +0900
+++ b/webGL/DrumSimulator.html	Mon May 14 16:19:40 2012 +0900
@@ -59,51 +59,51 @@
     }
   </script> 
   <script> 
-    renderStats = new Stats();
-    updateStats = new Stats();
+renderStats = new Stats();
+updateStats = new Stats();
 
-    var MODE = TITLE;
-    notesArray = [];
-    objsArray = [];
-    
-    /* these variables are defined at const.js */
+var MODE = TITLE;
+var AUTO = true;
+notesArray = [];
+objsArray = [];
+
+/* these variables are defined at const.js */
 //    var WIDTH = 1024;
 //    var HEIGHT = 640;
 //    var FPS = 50;
 //    var Interval = 1000/FPS;
 
 
-    function main(){
+function main(){
     document.body.appendChild(renderStats.domElement);
     document.body.appendChild(updateStats.domElement);
     c = document.getElementById("example");
     c.width = WIDTH;
     c.height = HEIGHT;
     var ctx = init();
-    framerate = new Framerate("framerate");
-
+    
     loop = (function(){
         nextGameTick = (new Date).getTime();
         return function(){
-	  while((new Date).getTime()>nextGameTick){
-            updateStats.update();
-            gameUpdate();
-            nextGameTick += Interval;
-          }
-          renderStats.update();
-          gameRender(ctx);
+	    while((new Date).getTime()>nextGameTick){
+		updateStats.update();
+		gameUpdate();
+		nextGameTick += Interval;
+	    }
+	    renderStats.update();
+	    gameRender(ctx);
         };
     })();
     toTitle();
     loadSounds();
     loadNotes();
-    }
-    
-    function gameStart(){
+}
+
+function gameStart(){
     setInterval(loop,0);
-    }
+}
 
-    function init(){
+function init(){
     var gl = initWebGL("example","vshader","fshader",["vNormal","vTexCoord","vPosition"],[0,0,0,1],10000);
     gl.uniform3f(gl.getUniformLocation(gl.program,"lightDir"),0,0,1);
     gl.uniform1i(gl.getUniformLocation(gl.program,"sampler2d"),0);
@@ -111,14 +111,14 @@
     parseXml(gl);
     
     return gl;
-    }
-    
+}
+
 
-    width = -1;
-    height = -1;
-    
-    function reshape(ctx)
-    {
+width = -1;
+height = -1;
+
+function reshape(ctx)
+{
     width = c.width;
     height = c.height;
     
@@ -126,8 +126,8 @@
     
     ctx.perspectiveMatrix = new J3DIMatrix4();
     ctx.perspectiveMatrix.ortho(0, -200, 0, -140, 0, 10000);
-    }
-    
+}
+
   </script> 
   <style type="text/css"> 
     canvas {
@@ -135,7 +135,6 @@
     }
   </style> 
   <body onload="main()" onkeydown="keybordDown()" onkeypress="keybordPress()" onkeyup="keybordUp()" style='overflow:scroll'>
-    <div id="framerate"></div> 
     <canvas id="example"> 
       There is supposed to be an example drawing here, but it's not important.
     </canvas>