Mercurial > projects > chipmunkd
comparison trunk/tests/ChipmunkDemos/samples/ChipmunkDemo.d @ 24:ee7fa417266b
osx fix rand_max
author | Stephan Dilly <stephan@extrawurst.org> |
---|---|
date | Fri, 10 Dec 2010 13:39:07 +0100 |
parents | af2f61a96318 |
children | b45f0b140d85 |
comparison
equal
deleted
inserted
replaced
23:4ceef5833c8c | 24:ee7fa417266b |
---|---|
21 demoInitFunc initFunc; | 21 demoInitFunc initFunc; |
22 demoUpdateFunc updateFunc; | 22 demoUpdateFunc updateFunc; |
23 demoDestroyFunc destroyFunc; | 23 demoDestroyFunc destroyFunc; |
24 } | 24 } |
25 | 25 |
26 // special hack for OSX | |
27 version(OSX) import std.random:uniform; | |
28 | |
26 static cpFloat | 29 static cpFloat |
27 frand() | 30 frand() |
28 { | 31 { |
32 version(OSX){ | |
33 return std.random.uniform(0,1); | |
34 }else{ | |
29 return cast(cpFloat)rand()/cast(cpFloat)RAND_MAX; | 35 return cast(cpFloat)rand()/cast(cpFloat)RAND_MAX; |
36 } | |
30 } | 37 } |
31 | 38 |
32 enum GRABABLE_MASK_BIT = (1<<31); | 39 enum GRABABLE_MASK_BIT = (1<<31); |
33 enum NOT_GRABABLE_MASK = (~GRABABLE_MASK_BIT); | 40 enum NOT_GRABABLE_MASK = (~GRABABLE_MASK_BIT); |