Mercurial > hg > Members > tkaito > task_dandy
annotate stage_init.cc @ 19:632ce41a842a
testing game task with pad's input
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Aug 2010 03:37:36 +0900 |
parents | 2c188b2becec |
children | fd9deaa67de9 |
rev | line source |
---|---|
2 | 1 #include "dandy.h" |
2 | |
7 | 3 void |
4 create_title(SchedTask *s, void *charactor_, void *b) | |
3 | 5 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
6 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; |
5 | 7 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
8 if (charactor->flag == 1) { |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
9 /* タイトルが終わり、次はココにゲームの準備をする処理を書く */ |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
10 printf("Title finished"); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
11 } |
4 | 12 } |
13 | |
3 | 14 void |
11 | 15 create_title_back(Viewer *sgroot_, int w, int h) |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
16 { |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
17 Viewer *sgroot = sgroot_; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
18 SceneGraphPtr back; |
3 | 19 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
20 back = sgroot->createSceneGraph(); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
21 charactor[0].x = w/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
22 charactor[0].y = h/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
23 charactor[0].vx = 1.0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
24 charactor[0].vy = 1.0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
25 charactor[0].flag = 0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
26 charactor[0].parent = (void*)back; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
27 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
28 SceneGraphPtr title = (SceneGraphPtr)charactor[0].root; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
29 title->xyz[0] = charactor[0].x; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
30 title->xyz[1] = charactor[0].y; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
31 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
32 int size = sizeof(ObjProperty); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
33 back->addChild(title); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
34 sgroot->setSceneData(back); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
35 sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title); |
3 | 36 } |
2 | 37 |
7 | 38 |
2 | 39 void |
4 | 40 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor) |
2 | 41 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
42 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
2 | 43 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
44 SceneGraphPtr stage = sgroot->createSceneGraph(); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
45 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy"); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
46 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
47 //mydandy->set_move_collision(dandy_move, dandy_coll); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
48 //stage->set_move_collision(stage_move, stage_coll); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
49 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
50 mydandy->xyz[0] = w/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
51 mydandy->xyz[1] = h*0.9; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
52 mydandy->xyz[2] = 0.0f; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
53 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
54 stage->addChild(mydandy); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
55 sgroot->setSceneData(stage); |
2 | 56 } |