| 191 | } |
| 192 | |
| 193 | static void update(cpSpace* space, double dt) |
| 194 | { |
| 195 | cpSpaceStep(space, dt); |
| 196 | |
| 197 | if (ChipmunkDemoRightDown) |
| 198 | { |
| 199 | cpPointQueryInfo info; |
| 200 | if (cpSpacePointQueryNearest(space, ChipmunkDemoMouse, 0, GRAB_FILTER, &info)) |
| 201 | { |
| 202 | cpBB bb = cpShapeGetBB(info.shape); |
| 203 | cpFloat cell_size = cpfmax(bb.r - bb.l, bb.t - bb.b) / 5.0f; |
| 204 | if (cell_size > 5.0f) |
| 205 | { |
| 206 | ShatterShape(space, (cpShape*)info.shape, cell_size, ChipmunkDemoMouse); |
| 207 | } |
| 208 | else |
| 209 | { |
| 210 | // printf("Too small to splinter %f\n", cell_size); |
| 211 | } |
| 212 | } |
| 213 | ChipmunkDemoRightDown = false; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | static cpSpace* init(void) |
| 218 | { |
nothing calls this directly
no test coverage detected