mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-26 13:20:05 +03:00
minor tweaks to old code
This commit is contained in:
parent
a2d1e5df2d
commit
d4ac2707c6
2 changed files with 14 additions and 11 deletions
6
audio.d
6
audio.d
|
@ -4,8 +4,6 @@ module arsd.audio;
|
|||
import sdl.SDL;
|
||||
import sdl.SDL_mixer;
|
||||
|
||||
import std.string;
|
||||
|
||||
import arsd.engine;
|
||||
|
||||
bool audioIsLoaded; // potential hack material
|
||||
|
@ -15,7 +13,7 @@ class Sound {
|
|||
this(char[] filename){
|
||||
if(!audioIsLoaded)
|
||||
return;
|
||||
sfx = Mix_LoadWAV(std.string.toStringz(filename));
|
||||
sfx = Mix_LoadWAV((filename ~ "\0").ptr);
|
||||
if(sfx is null)
|
||||
throw new Exception(immutableString("Sound load " ~ filename));
|
||||
}
|
||||
|
@ -45,7 +43,7 @@ class Music {
|
|||
this(char[] filename){
|
||||
if(!audioIsLoaded)
|
||||
return;
|
||||
mus = Mix_LoadMUS(std.string.toStringz(filename));
|
||||
mus = Mix_LoadMUS((filename~"\0").ptr);
|
||||
if(mus is null)
|
||||
throw new Exception(immutableString("Music load " ~ filename));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue