comparison Renderer/Test/ball_bound.cc @ 1029:ffe6ad89840e draft

copy script add.
author tkaito
date Mon, 15 Nov 2010 22:39:25 +0900
parents c7afc21e448d
children 801d57ae1e29
comparison
equal deleted inserted replaced
1028:cfec583ae7d3 1029:ffe6ad89840e
79 } 79 }
80 80
81 static void 81 static void
82 ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) 82 ball_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
83 { 83 {
84 vy += g * dt; 84 vy += g * dt;
85 node->xyz[1] += vy * dt; 85 node->xyz[1] += vy * dt;
86 // node->xyz[0] += 10.0f; 86 // node->xyz[0] += 10.0f;
87 } 87 }
88 88
89 static void 89 static void
90 ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree) 90 ball_collision_idle(SceneGraphPtr, void *sgroot_, int w, int h, SceneGraphPtr tree)
93 93
94 static void 94 static void
95 ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h, 95 ball_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
96 SceneGraphPtr tree) 96 SceneGraphPtr tree)
97 { 97 {
98 if (node->xyz[1] > screen_h - ball_radius) { 98 if (node->xyz[1] > screen_h - ball_radius) {
99 node->xyz[1] = screen_h - ball_radius; 99 node->xyz[1] = screen_h - ball_radius;
100 100
101 vy *= e; 101 vy *= e;
102 if (vy > -g && vy < 0) { 102 if (vy > -g && vy < 0) {
103 vy = 0.0; 103 vy = 0.0;
104 node->set_move_collision(ball_move_idle, ball_collision_idle); 104 node->set_move_collision(ball_move_idle, ball_collision_idle);
105 } 105 }
106 } 106 }
107 } 107 }
108 108
109 MainLoopPtr 109 MainLoopPtr
110 ball_bound::init(Viewer *sgroot, int screen_w, int screen_h) 110 ball_bound::init(Viewer *sgroot, int screen_w, int screen_h)
111 { 111 {