Mercurial > hg > Game > Cerium
comparison TaskManager/Test/test_render/Application/chain.cc @ 431:b40a9b901d71 draft
fix
author | game@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 24 Sep 2009 20:43:14 +0900 |
parents | 2c592936bbdf |
children | 7705fa2025da |
comparison
equal
deleted
inserted
replaced
429:e81bd66b01fb | 431:b40a9b901d71 |
---|---|
17 double vx, vy, next_vx, next_vy; | 17 double vx, vy, next_vx, next_vy; |
18 double angle[3]; | 18 double angle[3]; |
19 int can_move; | 19 int can_move; |
20 SceneGraphPtr parent; | 20 SceneGraphPtr parent; |
21 int id; | 21 int id; |
22 //int parent; | 22 int parent_id; |
23 } CHAIN_VARS; | 23 } PropertyPtr*; |
24 | 24 |
25 /* SceneGraph の property */ | 25 /* SceneGraph の property */ |
26 CHAIN_VARS* properties[2]; | 26 PropertyPtr properties[2]; |
27 CHAIN_VARS* property; | 27 PropertyPtr property; |
28 | |
28 | 29 |
29 | 30 |
30 //void createSceneGraphFromProperty(CHAIN_VARS* p) ; | 31 //void createSceneGraphFromProperty(CHAIN_VARS* p) ; |
31 void createSceneGraphFromProperty(void* p) ; | 32 void createSceneGraphFromProperty(void* p) ; |
32 | 33 |
33 void | 34 void |
34 init_chain_vars(CHAIN_VARS *cv) { | 35 Chain::init_chain_vars(CHAIN_VARS *cv) { |
35 cv->x = 0, cv->y = 0, cv->next_x = 0, cv->next_y = 0; | 36 cv->x = 0, cv->y = 0, cv->next_x = 0, cv->next_y = 0; |
36 cv->vx = 0, cv->vy = 0, cv->next_vx = 0, cv->next_vy = 0; | 37 cv->vx = 0, cv->vy = 0, cv->next_vx = 0, cv->next_vy = 0; |
37 cv->can_move = TRUE; | 38 cv->can_move = TRUE; |
38 } | 39 } |
39 | 40 |
45 sg->angle[0] = p->angle[0]; | 46 sg->angle[0] = p->angle[0]; |
46 sg->angle[1] = p->angle[1]; | 47 sg->angle[1] = p->angle[1]; |
47 sg->angle[2] = p->angle[2]; | 48 sg->angle[2] = p->angle[2]; |
48 } | 49 } |
49 | 50 |
50 | 51 /* |
51 static void | 52 static void |
52 chain_move_ope(SceneGraphPtr node, int screen_w, int screen_h) | 53 chain_move_ope(SceneGraphPtr node, int screen_w, int screen_h) |
53 { | 54 { |
54 Pad *pad = sgroot->getController(); | 55 Pad *pad = sgroot->getController(); |
55 | 56 |
68 } | 69 } |
69 } else { | 70 } else { |
70 property[CHAIN_LEN-1].can_move = TRUE; | 71 property[CHAIN_LEN-1].can_move = TRUE; |
71 } | 72 } |
72 } | 73 } |
74 */ | |
73 | 75 |
74 void | 76 void |
75 chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h) | 77 Chain::chain_move(TaskManager *manager, SceneGraphPtr sg, int w, int h) |
76 { | 78 { |
77 int id = sg->id; | 79 int id = sg->id; |
78 //CHAIN_VARS* p = (CHAIN_VARS*)sg->propertyptr; | 80 //PropertyPtr p = (PropertyPtr)sg->propertyptr; |
79 HTaskPtr chain_cal; | 81 HTaskPtr chain_cal; |
80 CHAIN_VARS* output; | 82 PropertyPtr output; |
81 | 83 |
82 // SceneGraph の切り替えもここでやる | 84 // SceneGraph の切り替えもここでやる |
83 if (property == properties[0]) { | 85 if (property == properties[0]) { |
84 property = properties[1]; | 86 property = properties[1]; |
85 output = properties[0]; | 87 output = properties[0]; |
95 chain_cal->spawn(); | 97 chain_cal->spawn(); |
96 | 98 |
97 } | 99 } |
98 | 100 |
99 void | 101 void |
100 chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg) | 102 Chain::chain_collision(SceneGraphPtr sg, int w, int h, SceneGraphPtr osg) |
101 { | 103 { |
102 | |
103 } | 104 } |
104 | 105 |
105 void | 106 void |
106 createSceneGraphFromProperty(void* p) | 107 createSceneGraphFromProperty(void* p) |
107 { | 108 { |
108 CHAIN_VARS* chain_p = (CHAIN_VARS*)p; | 109 PropertyPtr chain_p = (PropertyPtr)p; |
109 SceneGraphPtr chain_copy = sgroot->createSceneGraph(CHAIN); | 110 SceneGraphPtr chain_copy = sgroot->createSceneGraph(CHAIN); |
110 chain_copy->propertyptr = (void*)chain_p; | 111 chain_copy->propertyptr = (void*)chain_p; |
111 chain_copy->property_size = sizeof(CHAIN_VARS); | 112 chain_copy->property_size = sizeof(CHAIN_VARS); |
112 set_vector(chain_p, chain_copy); | 113 set_vector(chain_p, chain_copy); |
113 chain_p->parent->addChild(chain_copy); | 114 chain_p->parent->addChild(chain_copy); |
114 } | 115 } |
115 | 116 |
116 void | 117 void |
117 chain_init(TaskManager *manager, int w, int h) | 118 Chain::chain_init(TaskManager *manager, int w, int h) |
118 { | 119 { |
119 SceneGraphPtr root_chain, chain; | 120 SceneGraphPtr root_chain, chain; |
120 CHAIN_VARS rcv; | 121 CHAIN_VARS rcv; |
121 | 122 |
122 HTaskPtr chain_init; | 123 HTaskPtr chain_init; |
123 | 124 |
124 | 125 |
125 sgroot->createFromXMLfile(manager, "xml_file/chain.xml"); | 126 sgroot->createFromXMLfile(manager, "xml_file/chain.xml"); |
126 | 127 |
127 /* SPE に送る property の配列の領域確保 */ | 128 /* SPE に送る property の配列の領域確保 */ |
128 properties[0] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); | 129 properties[0] = (PropertyPtr)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); |
129 properties[1] = (CHAIN_VARS*)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); | 130 properties[1] = (PropertyPtr)manager->allocate(sizeof(CHAIN_VARS)*CHAIN_LEN); |
130 property = properties[0]; | 131 property = properties[0]; |
131 | 132 |
132 root_chain = sgroot->createSceneGraph(CHAIN); | 133 root_chain = sgroot->createSceneGraph(CHAIN); |
133 // set_move_collision()ではだめ | 134 // set_move_collision()ではだめ |
134 root_chain->set_move_collision(chain_move_ope, chain_collision); | 135 root_chain->set_move_collision(chain_move_ope, chain_collision); |