Mercurial > hg > Members > e105711
annotate webGL/src/mainfunc.js @ 6:8c25fd3f9866 draft
7th,change a way of sounds play
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 May 2012 01:49:16 +0900 |
parents | a730b51d59eb |
children | c5455ae6cd70 |
rev | line source |
---|---|
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 function gameRender(ctx,MODE){ |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 switch(MODE){ |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3 case TITLE: |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
4 titleRender(ctx); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
5 break; |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
6 case MAIN: |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
7 mainRender(ctx); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
8 break; |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
9 case PLAY: |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
10 playRender(ctx); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
11 } |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 } |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 |
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
|
14 function gameUpdate(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
|
15 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
|
16 case TITLE: |
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
|
17 // titleUpdate(); |
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
|
18 break; |
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
|
19 case MAIN: |
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
|
20 // mainUpdate(); |
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
|
21 break; |
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
|
22 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
|
23 playUpdate(); |
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
|
24 } |
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
|
25 } |
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
|
26 |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 function titleRender(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
|
28 reshape(ctx); |
6
8c25fd3f9866
7th,change a way of sounds play
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
29 ctx.clearColor(0,0,0,1); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 PutSpriteF(ctx,100,30,1,imgs[0]); |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
32 PutSpriteF(ctx,100,90,1,imgs[1]); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 PutSpriteF(ctx,100,70,1,imgs[6]); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 ctx.flush(); |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 } |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 function mainRender(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
|
38 reshape(ctx); |
6
8c25fd3f9866
7th,change a way of sounds play
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
39 ctx.clearColor(0,0,0,1); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
41 PutSpriteF(ctx,100,7.8125,1,imgs[2]); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
42 PutSpriteF(ctx,100,105,1,imgs[3]); //y == 480 |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
43 |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
44 PutSpriteF(ctx,100,70,1,imgs[6]); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
45 ctx.flush(); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
46 } |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
47 |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
48 function playRender(ctx){ |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
49 reshape(ctx); |
6
8c25fd3f9866
7th,change a way of sounds play
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
50 ctx.clearColor(0,0,0,1); |
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 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
52 PutSpriteF(ctx,100,7.8125,1,imgs[2]); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
53 PutSpriteF(ctx,100,105,1,imgs[3]); //y == 480 |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
54 for(i=0;i<notesArray.length;i++){ |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
55 drawNote(ctx,notesArray[i]); |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
56 } |
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 PutSpriteF(ctx,100,70,1,imgs[6]); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 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
|
59 } |
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
|
60 |
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
|
61 function playUpdate(){ |
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
|
62 for(i=0;i<notesArray.length;i++){ |
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
|
63 updNote(notesArray[i]); |
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 } |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 } |