Mercurial > projects > chipmunkd
comparison trunk/tests/ChipmunkDemos/samples/ChipmunkDemo.d @ 16:af2f61a96318
ported chipmunk demos
author | Extrawurst |
---|---|
date | Sat, 04 Dec 2010 02:02:29 +0100 |
parents | |
children | ee7fa417266b |
comparison
equal
deleted
inserted
replaced
15:df4ebc8add66 | 16:af2f61a96318 |
---|---|
1 | |
2 // written in the D programming language | |
3 | |
4 module samples.ChipmunkDemo; | |
5 | |
6 import chipmunkd.chipmunk; | |
7 | |
8 import drawSpace; | |
9 | |
10 import core.stdc.stdlib; | |
11 | |
12 alias cpSpace *function() demoInitFunc; | |
13 alias void function(int ticks) demoUpdateFunc; | |
14 alias void function()demoDestroyFunc; | |
15 | |
16 struct chipmunkDemo { | |
17 string name; | |
18 | |
19 const drawSpaceOptions *drawOptions; | |
20 | |
21 demoInitFunc initFunc; | |
22 demoUpdateFunc updateFunc; | |
23 demoDestroyFunc destroyFunc; | |
24 } | |
25 | |
26 static cpFloat | |
27 frand() | |
28 { | |
29 return cast(cpFloat)rand()/cast(cpFloat)RAND_MAX; | |
30 } | |
31 | |
32 enum GRABABLE_MASK_BIT = (1<<31); | |
33 enum NOT_GRABABLE_MASK = (~GRABABLE_MASK_BIT); |