comparison TaskManager/Test/test_render/node.cpp @ 354:81b25e5d5379

add example/get_segment and change spe/DrawSpan.cpp
author koba
date Wed, 15 Jul 2009 17:39:51 +0900
parents 58eacf676bb5
children b89ba1d96fff
comparison
equal deleted inserted replaced
284:6ceb40aec7fb 354:81b25e5d5379
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include "SceneGraphRoot.h"
2 #include "SceneGraph.h" 3 #include "SceneGraph.h"
3 #include "xml_file/cube.h" 4 #include "xml_file/cube.h"
4 5
5 static void 6 static void
6 cube_collision(SceneGraphPtr node, int screen_w, int screen_h, 7 cube_collision(SceneGraphPtr node, int screen_w, int screen_h,
42 43
43 node->xyz[1] += node->stack_xyz[1]; 44 node->xyz[1] += node->stack_xyz[1];
44 if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { 45 if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) {
45 46
46 // 実は微妙に意味が無い 47 // 実は微妙に意味が無い
47 srandom(random()); 48 // そうじゃなくて、やっちゃいけないことです。
49 // srandom(random());
48 50
49 SceneGraphPtr p = node->clone(); 51 SceneGraphPtr p = node->clone();
50 p->position_init(); 52 p->position_init();
51 node->addBrother(p); 53 node->addBrother(p);
52 p->set_move_collision(cube_move2, cube_collision); 54 p->set_move_collision(cube_move2, cube_collision);
61 } 63 }
62 64
63 void 65 void
64 node_init(void) 66 node_init(void)
65 { 67 {
66 SceneGraph::createFromXMLfile("xml_file/cube.xml"); 68 sgroot->createFromXMLfile("xml_file/cube.xml");
67 Cube->set_move_collision(cube_move, cube_collision); 69 Cube->set_move_collision(cube_move, cube_collision);
68 Cube->stack_xyz[0] = 2.0f; 70 Cube->stack_xyz[0] = 2.0f;
69 Cube->stack_xyz[1] = 2.0f; 71 Cube->stack_xyz[1] = 2.0f;
70 } 72 }