static std::function<Layer*()> createFunctions[] = {
#if CC_USE_PHYSICS
CL(PhysicsDemoLogoSmash),
CL(PhysicsDemoPyramidStack),
CL(PhysicsDemoClickAdd),
CL(PhysicsDemoRayCast),
CL(PhysicsDemoJoints),
CL(PhysicsDemoActions),
CL(PhysicsDemoPump),
CL(PhysicsDemoOneWayPlatform),
CL(PhysicsDemoSlice),
CL(PhysicsDemoBug3988),
CL(PhysicsContactTest),
CL(PhysicsPositionRotationTest),
CL(PhysicsSetGravityEnableTest),
CL(Bug5482),
CL(PhysicsTransformTest),
#else
CL(PhysicsDemoDisabled),
#endif
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
其中:
sizeof(createFunctions)表示数组总字节数
sizeof(createFunctions[0])表示数组每个元素的字节数