Mercurial > hg > Members > e105711
annotate 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 |
rev | line source |
---|---|
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
1 function gameRender(ctx){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
2 drawObj(ctx); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 } |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
5 function gameUpdate(){ |
5
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
6 switch(MODE){ |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
7 case PLAY: |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
8 playUpdate(); |
15
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
9 break; |
16 | 10 default: |
15
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
11 break; |
5
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
12 } |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
13 } |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
14 |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
15 function toTitle(){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
16 MODE = TITLE; |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
17 objsArray.length = 0; |
16 | 18 objsArray.push(new Obj(100,30,1,"title")); |
19 objsArray.push(new Obj(100,90,1,"press")); | |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 } |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 |
13 | 22 function toMenu(){ |
23 MODE = MENU; | |
24 objsArray.length = 0; | |
16 | 25 objsArray.push(new Obj(100,7.8125,1,"select_music")); |
26 // loadMusicTitle(cursor.getIndex()); | |
27 // drawText(ctx,"music_title",musicsArray(cursor.getIndex()).getTitle(),60,"white","center",432,86); | |
28 objsArray.push(new Obj(100,40,1,"music_title")); | |
13 | 29 } |
30 | |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
31 function toMain(){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
32 MODE = MAIN; |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
33 objsArray.length = 0; |
16 | 34 objsArray.push(new Obj(100,7.8125,1,"main_mode")); // main mode |
35 objsArray.push(new Obj(100,105,1,"line")); | |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
36 } |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
37 |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
38 function toPlay(){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
39 MODE = PLAY; |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
40 objsArray.length = 0; |
16 | 41 objsArray.push(new Obj(100,7.8125,1,"main_mode")); // main mode |
13 | 42 loadMusics(musicsArray[cursor.getIndex()]); |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
43 } |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
44 |
15
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
45 function toResult(){ |
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
46 MODE = RESULT; |
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
47 showResult(); |
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
48 } |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
49 |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
50 function drawObj(ctx){ |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
51 reshape(ctx); |
6
8c25fd3f9866
7th,change a way of sounds play
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
52 ctx.clearColor(0,0,0,1); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
54 for(var i=0;i < objsArray.length;i++){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
55 var obj = objsArray[i]; |
16 | 56 PutSpriteF(ctx,obj.x,obj.y,obj.scale,ctx.obj[obj.imgName]); |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 } |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
58 if(MODE==PLAY){ |
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
59 drawNote(ctx); |
16 | 60 PutSpriteF(ctx,100,105,1,ctx.obj["line"]); // line |
7
c5455ae6cd70
8th,change a way of update to notes,support ogg and wav sound
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
61 } |
16 | 62 PutSpriteF(ctx,100,70,1,ctx.obj["back"]); // background |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 ctx.flush(); |
5
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
64 } |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
65 |
a730b51d59eb
6th:use stat.js,divide render and update,change a way of updating game.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
66 function playUpdate(){ |
10
98a90bc478b3
Change function name.upd->update
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
9
diff
changeset
|
67 updateNote(); |
15
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
68 if(BGMEndCheck()){ |
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
69 toResult(); |
80789d11de5c
add function for text draw
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
70 } |
13 | 71 } |
72 |