Mercurial > hg > Members > e105711
changeset 14:1eebc1f7874d draft
add script for count a number of music files
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 07 Jun 2012 23:12:53 +0900 |
parents | 74dc1d5f2e47 |
children | 80789d11de5c |
files | webGL/DrumSimulator.html webGL/ruby/directoryReader.rb webGL/src/Cursor.js webGL/src/f4notes.js webGL/src/loadMusicFiles.js |
diffstat | 5 files changed, 28 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/webGL/DrumSimulator.html Thu Jun 07 02:47:08 2012 +0900 +++ b/webGL/DrumSimulator.html Thu Jun 07 23:12:53 2012 +0900 @@ -18,6 +18,7 @@ <script src="src/Obj.js"></script> <script src="src/jquery-1.7.2.min.js"></script> <script src="src/Cursor.js"></script> + <script src="src/loadMusicFiles.js"></script> </head> <script id="vshader" type="x-shader/x-vertex"> uniform mat4 u_modelViewProjMatrix; @@ -71,7 +72,6 @@ var musicsArray = []; var cursor = new Cursor(); - /* these variables are defined at const.js */ // var WIDTH = 1024; // var HEIGHT = 640; @@ -103,7 +103,6 @@ toTitle(); loadSounds(); loadMusicFiles(); -// loadNotes("music/test2.json"); } function gameStart(){
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webGL/ruby/directoryReader.rb Thu Jun 07 23:12:53 2012 +0900 @@ -0,0 +1,14 @@ +#!/user/bin/ruby + +dir = Dir.open("../music/"); +file = File.open("../src/loadMusicFiles.js","w"); +file.print "function loadMusicFiles(){\n"; +dir.each{|list| + if list.match("json") then + file.print "\tmusicsArray.push(\"music/" + list + "\");\n"; + end +} +file.print "\tcursor.setMAX(musicsArray.length);\n"; +file.print "}\n"; +dir.close(); +file.close();
--- a/webGL/src/Cursor.js Thu Jun 07 02:47:08 2012 +0900 +++ b/webGL/src/Cursor.js Thu Jun 07 23:12:53 2012 +0900 @@ -1,6 +1,6 @@ var Cursor = function(){ this.index = 0; - this.MAX = 2; + this.MAX = 0; }; Cursor.prototype.getIndex = function(){ @@ -25,4 +25,8 @@ Cursor.prototype.reset = function(){ this.index = 0; +}; + +Cursor.prototype.setMAX = function(MAX){ + this.MAX = MAX; }; \ No newline at end of file
--- a/webGL/src/f4notes.js Thu Jun 07 02:47:08 2012 +0900 +++ b/webGL/src/f4notes.js Thu Jun 07 23:12:53 2012 +0900 @@ -114,12 +114,13 @@ function noteAdd(time,lane,BPM){ notesArray[lane-1].push(new Note(time,lane,BPM)); } - +/* function loadMusicFiles(){ musicsArray.push("music/test.json"); musicsArray.push("music/test2.json"); + cursor.setMAX(musicsArray.length); } - +*/ function loadMusics(filepath){ var httpObj = jQuery.get(filepath,null,function(){