diff options
author | Viljami Ilola <+@hix.fi> | 2024-04-27 01:29:45 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-04-27 01:29:45 +0300 |
commit | 7a33e5020f9b1e7cf89bc532e2ddcf681f5bcf9c (patch) | |
tree | 544e868288f05213452dec9b7b789bd1eb208191 /src/sliceitoff/game | |
parent | a4794437d561a01c8bea12d59502e4cc72acfbea (diff) |
volume control
Diffstat (limited to 'src/sliceitoff/game')
-rw-r--r-- | src/sliceitoff/game/game.py | 4 | ||||
-rw-r--r-- | src/sliceitoff/game/settings.py | 17 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py index f85a544..57f2c56 100644 --- a/src/sliceitoff/game/game.py +++ b/src/sliceitoff/game/game.py @@ -21,7 +21,7 @@ from .mainmenu import Mainmenu, MenuItems from .level import Level from .show import Show from .initials import Initials -from .settings import Settings +from .settings import SettingsMenu class Game: """ This is the whole game. """ @@ -84,7 +84,7 @@ class Game: def settings(self): """ settings menu where one can adjust volume for example """ - menu = Settings() + menu = SettingsMenu() while menu.active: menu.update(dt = self.clock.tick()) self.display.update([menu]) diff --git a/src/sliceitoff/game/settings.py b/src/sliceitoff/game/settings.py index 6a709a4..53d0362 100644 --- a/src/sliceitoff/game/settings.py +++ b/src/sliceitoff/game/settings.py @@ -1,4 +1,4 @@ -""" game.mainmenu - Let's user choose """ +""" game.settings - Settings dialog """ from enum import IntEnum import pygame @@ -11,16 +11,16 @@ from .explodeout import ExplodeOutGroup MOUSE_TRESHOLD = 100 class MenuItems(IntEnum): - """ Items in the menu. Should match mainmenu_screen """ + """ Items in the menu. Should match settings_screen """ SFX = 0 MUSIC = 1 BACK = 2 -class Settings(ExplodeOutGroup): +class SettingsMenu(ExplodeOutGroup): """ sprite group with imputs to make selection """ def __init__(self): super().__init__() - self.add(settings_screen(0)) + self.add(settings_screen(0,0,0)) self.selection = 0 self.mousey = 0 @@ -29,6 +29,10 @@ class Settings(ExplodeOutGroup): match self.selection: case MenuItems.BACK: self.do_fadeout() + case MenuItems.SFX: + sfx.sfx_up() + case MenuItems.MUSIC: + sfx.music_up() def update(self, dt = 0, **kwargs): """ Does it all. Reads keyboard and updates screen """ @@ -49,7 +53,10 @@ class Settings(ExplodeOutGroup): elif event.type == pygame.MOUSEMOTION: self.process_mouse_motion() self.empty() - self.add(settings_screen(self.selection)) + self.add(settings_screen( + self.selection, + sfx.sfx_volume, + sfx.music_volume)) def process_mouse_motion(self): """ Mouse movement up or down moves menu selection """ |