Mercurial > hg > Members > e105711
annotate webGL/src/mainfunc.js @ 13:74dc1d5f2e47 draft
can select music
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 07 Jun 2012 02:47:08 +0900 |
parents | 98a90bc478b3 |
children | 80789d11de5c |
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 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
|
8 // 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
|
9 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
|
10 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
|
11 // 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
|
12 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
|
13 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
|
14 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
|
15 } |
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 } |
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 |
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
|
18 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
|
19 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
|
20 objsArray.length = 0; |
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
|
21 objsArray.push(new Obj(100,30,1,0)); |
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
|
22 objsArray.push(new Obj(100,90,1,1)); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 } |
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 |
13 | 25 function toMenu(){ |
26 MODE = MENU; | |
27 objsArray.length = 0; | |
28 objsArray.push(new Obj(100,7.8125,1,7)); // select music | |
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; |
13 | 34 objsArray.push(new Obj(100,7.8125,1,2)); // main mode |
35 objsArray.push(new Obj(100,105,1,3)); // judge 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; |
13 | 41 objsArray.push(new Obj(100,7.8125,1,2)); // main mode |
42 loadMusics(musicsArray[cursor.getIndex()]); | |
43 // audioBGM.play(); | |
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
|
44 } |
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
|
45 |
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
|
46 |
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
|
47 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
|
48 reshape(ctx); |
6
8c25fd3f9866
7th,change a way of sounds play
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
49 ctx.clearColor(0,0,0,1); |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 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
|
51 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
|
52 var obj = objsArray[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
|
53 PutSpriteF(ctx,obj.x,obj.y,obj.scale,imgs[obj.imgNo]); |
2
55702e139f69
3rd,show Notes and set Timing, but it is not completely.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
54 } |
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
|
55 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
|
56 drawNote(ctx); |
13 | 57 PutSpriteF(ctx,100,105,1,imgs[3]); // 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
|
58 } |
8
040c922bd7ff
keyChar -> keyCode,add sounds
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
59 PutSpriteF(ctx,100,70,1,imgs[6]); // background |
9 | 60 |
0
9285dae61395
1st commit,just play sounds.
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 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
|
62 } |
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 |
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 function playUpdate(){ |
10
98a90bc478b3
Change function name.upd->update
e105711 <yomitan.ie.u-ryukyu.ac.jp>
parents:
9
diff
changeset
|
65 updateNote(); |
13 | 66 } |
67 |