MCPcopy Create free account
hub / github.com/axmolengine/axmol / update

Function update

tests/cpp-tests/Source/ChipmunkTestBed/demo/Shatter.cpp:193–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193static 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
217static cpSpace* init(void)
218{

Callers

nothing calls this directly

Calls 5

cpSpaceStepFunction · 0.85
cpSpacePointQueryNearestFunction · 0.85
cpShapeGetBBFunction · 0.85
cpfmaxFunction · 0.85
ShatterShapeFunction · 0.85

Tested by

no test coverage detected