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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
1 #include "dandy.h"
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
2
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
3 void
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
4 create_title(SchedTask *s, void *charactor_, void *b)
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
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
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
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
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
12 }
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
13
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
14 void
11
tkaito
parents: 10
diff changeset
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
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
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
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
36 }
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
37
7
c015109a6041 schedule add. 10% done.
tkaito
parents: 6
diff changeset
38
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
39 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
40 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
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
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
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
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
56 }