SVG Loader/Native Format
Posted: Mon Feb 11, 2008 2:06 am
I'm sure this wouldn't go into the main library, but an SVG Loader (that turns an SVG into a body with shapes) wouldn't be that hard would it?
Otherwise, a much easier (and perhaps better) solution would be to make an editor which save chipmunk files, which could just be xml files like so:
Just a thought. Maybe I'll learn to parse xml in c++ and do it.
Otherwise, a much easier (and perhaps better) solution would be to make an editor which save chipmunk files, which could just be xml files like so:
Code: Select all
<chipmunk>
<space>
<body name="bodyA" mass="5.2" px="300" py="222"><!--you could have the loader calculate the moment of inertia-->
<shape type="circle" radius="8" friction="0.4"/>
</body>
<body name="bodyB" mass="10" px="200" py="500">
<shape type="poly">
<vert x="-2" y="-2"/>
<vert x="-2" y="2"/>
<vert x="2" y="2"/>
<vert x="2" y="-2"/>
</shape>
</body>
<joint type="pin" bodya="bodyA" bodyb="bodyB" /><!--and so on-->
</space>
</chipmunk>