diff options
author | rodri <rgl@antares-labs.eu> | 2024-11-07 15:39:43 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-11-07 15:39:43 +0000 |
commit | 14f6cbebf7ad394f1b104b99c3ef788ce1eebddc (patch) | |
tree | 68160d0abda69ff1b576103fe15a5546f6592758 /bts.c | |
parent | 811630a877af97cceba4f43a16eb3fbd9ed99242 (diff) | |
download | battleship-14f6cbebf7ad394f1b104b99c3ef788ce1eebddc.tar.gz battleship-14f6cbebf7ad394f1b104b99c3ef788ce1eebddc.tar.bz2 battleship-14f6cbebf7ad394f1b104b99c3ef788ce1eebddc.zip |
copy the assets into /sys/games/lib.
Diffstat (limited to 'bts.c')
-rw-r--r-- | bts.c | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -129,7 +129,9 @@ Cursor aimcursor = { } }; char deffont[] = "/lib/font/bit/pelm/unicode.9.font"; -char titlefontpath[] = "assets/font/gunmetal/gunmetal.48.font"; +char assetdir[] = "/sys/games/lib/battleship"; +//char assetdir[] = "assets"; +char titlefontpath[] = "font/gunmetal/gunmetal.48.font"; Font *titlefont; char winspec[32]; char uid[8+1], oid[8+1]; @@ -557,21 +559,23 @@ initsfx(void) double gain; int loops; } sndtab[NSOUNDS] = { - [SBG0] {"assets/sfx/bg0.mp3", 1.0, 1}, - [SBG1] {"assets/sfx/bg1.mp3", 1.0, 1}, - [SBG2] {"assets/sfx/bg2.mp3", 1.0, 1}, - [SCANNON] {"assets/sfx/cannon.mp3", 5.0, 0}, - [SWATER] {"assets/sfx/water.mp3", 3.0, 0}, - [SVICTORY] {"assets/sfx/victory.mp3", 1.0, 1}, - [SDEFEAT] {"assets/sfx/defeat.mp3", 1.0, 1}, + [SBG0] {"sfx/bg0.mp3", 1.0, 1}, + [SBG1] {"sfx/bg1.mp3", 1.0, 1}, + [SBG2] {"sfx/bg2.mp3", 1.0, 1}, + [SCANNON] {"sfx/cannon.mp3", 5.0, 0}, + [SWATER] {"sfx/water.mp3", 3.0, 0}, + [SVICTORY] {"sfx/victory.mp3", 1.0, 1}, + [SDEFEAT] {"sfx/defeat.mp3", 1.0, 1}, }; int i; + char aux[64]; initaudio(44100); audio_set_master_gain(0.5); for(i = 0; i < NSOUNDS; i++){ - playlist[i] = loadaudiosource(sndtab[i].path); + snprint(aux, sizeof aux, "%s/%s", assetdir, sndtab[i].path); + playlist[i] = loadaudiosource(aux); if(playlist[i] == nil) sysfatal("loadaudiosource: %r"); audio_set_gain(playlist[i], sndtab[i].gain); @@ -1066,6 +1070,7 @@ usage(void) void threadmain(int argc, char *argv[]) { + char aux[64]; char *addr; char *user; int fd; @@ -1113,7 +1118,8 @@ threadmain(int argc, char *argv[]) worldrf.bx = Vec2(1,0); worldrf.by = Vec2(0,1); - titlefont = openfont(display, titlefontpath); + snprint(aux, sizeof aux, "%s/%s", assetdir, titlefontpath); + titlefont = openfont(display, aux); if(titlefont == nil) sysfatal("openfont: %r"); |