diff webGL/src/mainfunc.js @ 16:b322a8557f93 draft

draw text
author e105711 <yomitan.ie.u-ryukyu.ac.jp>
date Tue, 03 Jul 2012 23:20:21 +0900
parents 80789d11de5c
children 1e8fa3c370ab
line wrap: on
line diff
--- a/webGL/src/mainfunc.js	Sun Jul 01 22:01:18 2012 +0900
+++ b/webGL/src/mainfunc.js	Tue Jul 03 23:20:21 2012 +0900
@@ -4,16 +4,10 @@
 
 function gameUpdate(){
     switch(MODE){
-    case TITLE:
-//	titleUpdate();
-	break;
-    case MAIN:
-//	mainUpdate();
-	break;
     case PLAY:
 	playUpdate();
 	break;
-    case RESULT:
+    default:
 	break;
     }    
 }
@@ -21,27 +15,30 @@
 function toTitle(){
     MODE = TITLE;
     objsArray.length = 0;
-    objsArray.push(new Obj(100,30,1,0));
-    objsArray.push(new Obj(100,90,1,1));
+    objsArray.push(new Obj(100,30,1,"title"));
+    objsArray.push(new Obj(100,90,1,"press"));
 }
 
 function toMenu(){
     MODE = MENU;
     objsArray.length = 0;
-    objsArray.push(new Obj(100,7.8125,1,7)); // select music    
+    objsArray.push(new Obj(100,7.8125,1,"select_music"));
+//    loadMusicTitle(cursor.getIndex());
+//    drawText(ctx,"music_title",musicsArray(cursor.getIndex()).getTitle(),60,"white","center",432,86);
+    objsArray.push(new Obj(100,40,1,"music_title"));
 }
 
 function toMain(){
     MODE = MAIN;
     objsArray.length = 0;
-    objsArray.push(new Obj(100,7.8125,1,2)); // main mode
-    objsArray.push(new Obj(100,105,1,3)); // judge line
+    objsArray.push(new Obj(100,7.8125,1,"main_mode")); // main mode
+    objsArray.push(new Obj(100,105,1,"line"));
 }
 
 function toPlay(){
     MODE = PLAY;
     objsArray.length = 0;
-    objsArray.push(new Obj(100,7.8125,1,2)); // main mode
+    objsArray.push(new Obj(100,7.8125,1,"main_mode")); // main mode
     loadMusics(musicsArray[cursor.getIndex()]);
 }
 
@@ -56,13 +53,13 @@
     ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT);
     for(var i=0;i < objsArray.length;i++){
 	var obj = objsArray[i];
-	PutSpriteF(ctx,obj.x,obj.y,obj.scale,imgs[obj.imgNo],imgs[obj.imgNo].texture);
+	PutSpriteF(ctx,obj.x,obj.y,obj.scale,ctx.obj[obj.imgName]);
     }
     if(MODE==PLAY){
 	drawNote(ctx);
-	PutSpriteF(ctx,100,105,1,imgs[3],imgs[3].texture); // line
+	PutSpriteF(ctx,100,105,1,ctx.obj["line"]); // line
     }
-    PutSpriteF(ctx,100,70,1,imgs[6],imgs[6].texture); // background
+    PutSpriteF(ctx,100,70,1,ctx.obj["back"]); // background
     ctx.flush();
 }