2 This file is part of POCA - a puzzle game
4 POCA is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This software is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>.
54 music
= 'sacred_ground'
94 music
= 'cave_of_secrets'
103 function load_sounds()
104 for name
, volume
in pairs
{
115 if not sounds
[name
] then
116 sounds
[name
] = love
.audio
.newSource('snd/' .. name
.. '.wav', 'static')
118 sounds
[name
]:setVolume(volume
* settings
.sounds_volume
)
123 function play_music(title
, repeatable
)
124 if not (title
and settings
.music
) then return end
125 local filename
= title
126 -- if title isn't in backgrounds, assume it's a filename
127 if backgrounds
[title
] then filename
= backgrounds
[title
].music
end
128 if not repeatable
and current
.played
== filename
then return end
129 current
.played
= filename
130 filename
= 'snd/' .. (filename
or title
) .. '.it'
131 if not love
.filesystem
.getInfo(filename
) then
132 print('Music not found: ' .. title
)
135 if current
.music
then
137 current
.music
:release()
140 current
.music
= love
.audio
.newSource(filename
, 'stream')
141 current
.music
:setVolume(settings
.music_volume
)
146 function play_sound(s
)
147 if s
== 'dead' and settings
.vibrate
then love
.system
.vibrate(.3) end
148 if not settings
.sounds
then return end
154 function draw_background()
155 local b
= current
.background
or
156 backgrounds
[level_labels
[game
.currentlevel]]
.color
or {0, 0, 0}
157 love
.graphics
.clear(b
)