Mercurial > hg > Members > e105711
view webGL/src/mainfunc.js @ 28:42d54603b2d5 draft default tip
add graffle
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Jul 2012 17:04:43 +0900 |
parents | df7f7eef72ef |
children |
line wrap: on
line source
function gameRender(ctx){ drawObj(ctx); } function gameUpdate(){ switch(MODE){ case PLAY: playUpdate(); break; default: break; } } function toTitle(){ MODE = TITLE; resetResult(); objsArray.length = 0; objsArray.push(new Obj(100,30,1,"title")); objsArray.push(new Obj(100,90,1,"press")); } function toMenu(){ MODE = MENU; resetResult(); objsArray.length = 0; objsArray.push(new Obj(100,7.8125,1,"select_music")); loadMusicTitle(cursor.getIndex()); objsArray.push(new Obj(100,40,1,"music_title")); } function toMain(){ MODE = MAIN; resetResult(); objsArray.length = 0; objsArray.push(new Obj(100,7.8125,1,"main_mode")); objsArray.push(new Obj(100,105,1,"line")); } function toPlay(){ MODE = PLAY; resetResult(ctx); objsArray.length = 0; objsArray.push(new Obj(100,7.8125,1,"main_mode")); objsArray.push(new Obj(100,40,1,"judge")); dummyPlay(); loadMusics(musicsArray[cursor.getIndex()]); } function toResult(){ objsArray.length = 0; objsArray.push(new Obj(100,7.8125,1,"result_title")); MODE = RESULT; showResult(); } function drawObj(ctx){ reshape(ctx); 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,ctx.obj[obj.imgName]); } if(MODE==PLAY){ drawNote(ctx); PutSpriteF(ctx,100,105,1,ctx.obj["line"]); drawBeam(ctx); } PutSpriteF(ctx,100,70,1,ctx.obj["back"]); ctx.flush(); } function playUpdate(){ updateNote(); if(BGMEndCheck()){ toResult(); } }