Skip to content

Commit

Permalink
components/sound: correct variable shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
200sc committed Jan 11, 2022
1 parent 4f346d6 commit 874993c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions components/sound/bar.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func NewBar(kind BarKind, pos floatgeom.Point2, w, h int) *entities.Solid {
var eventName string
switch kind {
case BarKindMaster:
eventName = "MasterVolumeChanged"
eventName = EventMasterVolumeChanged
dl.Progress = volume
case BarKindMusic:
eventName = "MusicVolumeChanged"
eventName = EventMusicVolumeChanged
dl.Progress = musicVolume
case BarKindSFX:
eventName = "SFXVolumeChanged"
eventName = EventSFXVolumeChanged
dl.Progress = sfxVolume
}
solid.CID.Bind(eventName, func(id event.CID, payload interface{}) int {
Expand Down
6 changes: 3 additions & 3 deletions components/sound/sound.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ var initOnce sync.Once

// Init loads assets and initializes volume levels. It will do nothing
// after it has been called once.
func Init(masterVolume, musicVolume, sfxVolume float64) {
func Init(masterVolume, mVolume, sVolume float64) {
initOnce.Do(func() {
ReloadMusicAssets()
ReloadSFXAssets()

volume = masterVolume
musicVolume = musicVolume
sfxVolume = sfxVolume
musicVolume = mVolume
sfxVolume = sVolume

updateSFXVolume(volume, sfxVolume)
updateMusicVolume(volume, musicVolume)
Expand Down

0 comments on commit 874993c

Please sign in to comment.