added manyloc test suite; --path now relative to project dir if not absolute

This commit is contained in:
Araq 2013-04-13 21:55:02 +02:00
commit 75b508032b
51 changed files with 9286 additions and 5 deletions

View file

@ -0,0 +1,38 @@
when defined(NoSFML) or defined(NoChipmunk):
{.error.}
import sfml_audio, sfml_stuff, sg_assets, chipmunk
const
MinDistance* = 350.0
Attenuation* = 20.0
var
liveSounds: seq[PSound] = @[]
deadSounds: seq[PSound] = @[]
proc playSound*(sound: PSoundRecord, pos: TVector) =
if sound.isNil or sound.soundBuf.isNil: return
var s: PSound
if deadSounds.len == 0:
s = sfml_audio.newSound()
s.setLoop false
s.setRelativeToListener true
s.setAttenuation Attenuation
s.setMinDistance MinDistance
else:
s = deadSounds.pop()
s.setPosition(vec3f(pos.x, 0, pos.y))
s.setBuffer(sound.soundBuf)
s.play()
liveSounds.add s
proc updateSoundBuffer*() =
var i = 0
while i < len(liveSounds):
if liveSounds[i].getStatus == Stopped:
deadSounds.add liveSounds[i]
liveSounds.del i
else:
inc i
proc report*() =
echo "live: ", liveSounds.len
echo "dead: ", deadSounds.len