更改opus编码以节约体积
This commit is contained in:
parent
d048ab0ada
commit
ab56c3ddf7
@ -64,10 +64,10 @@ nuitka --mingw --standalone --onefile --show-progress --show-memory --windows-di
|
||||
加了背景音乐播放功能之后需要执行:
|
||||
|
||||
``` powershell
|
||||
nuitka --mingw --standalone --onefile --show-progress --show-memory --windows-disable-console --output-dir=out --windows-icon-from-ico=pypvz.ico --include-data-dir=resources=resources --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libvorbisfile-3.dll=libvorbisfile-3.dll main.py
|
||||
nuitka --mingw --standalone --onefile --show-progress --show-memory --output-dir=out --windows-icon-from-ico=pypvz.ico --include-data-dir=resources=resources --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libogg-0.dll=libogg-0.dll --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libopus-0.dll=libopus-0.dll --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libopusfile-0.dll=libopusfile-0.dll --windows-disable-console main.py
|
||||
```
|
||||
|
||||
其中,`C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libvorbisfile-3.dll`应当替换为`libvorbisfile-3.dll`实际所在路径
|
||||
其中,`C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\*.dll`应当替换为`*.dll`实际所在路径
|
||||
|
||||
可执行文件生成路径为`./out/main.exe`
|
||||
|
||||
|
||||
Binary file not shown.
BIN
resources/music/battle.opus
Normal file
BIN
resources/music/battle.opus
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/music/bowling.opus
Normal file
BIN
resources/music/bowling.opus
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/music/chooseYourSeeds.opus
Normal file
BIN
resources/music/chooseYourSeeds.opus
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/music/dayLevel.opus
Normal file
BIN
resources/music/dayLevel.opus
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/music/intro.opus
Normal file
BIN
resources/music/intro.opus
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/music/nightLevel.opus
Normal file
BIN
resources/music/nightLevel.opus
Normal file
Binary file not shown.
@ -46,7 +46,7 @@ class Level(tool.State):
|
||||
self.done = True
|
||||
self.next = c.MAIN_MENU
|
||||
pg.mixer.music.stop()
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.ogg"))
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.opus"))
|
||||
pg.mixer.music.play(-1, 0)
|
||||
return
|
||||
if self.map_data[c.SHOVEL] == 0:
|
||||
@ -58,14 +58,14 @@ class Level(tool.State):
|
||||
global bgm
|
||||
if mode == modeList[1]: # 冒险模式
|
||||
if self.game_info[c.LEVEL_NUM] in {0, 1, 2}: # 白天关卡
|
||||
bgm = 'dayLevel.ogg'
|
||||
bgm = 'dayLevel.opus'
|
||||
elif self.game_info[c.LEVEL_NUM] in {3}: # 夜晚关卡
|
||||
bgm = 'nightLevel.ogg'
|
||||
bgm = 'nightLevel.opus'
|
||||
elif mode == modeList[0]: # 小游戏模式
|
||||
if self.game_info[c.LEVEL_NUM] in {1}: # 传送带大战
|
||||
bgm = 'battle.ogg'
|
||||
bgm = 'battle.opus'
|
||||
elif self.game_info[c.LEVEL_NUM] in {2}: # 坚果保龄球
|
||||
bgm = 'bowling.ogg'
|
||||
bgm = 'bowling.opus'
|
||||
pg.mixer.music.stop()
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", bgm))
|
||||
pg.mixer.music.play(-1, 0)
|
||||
@ -295,7 +295,7 @@ class Level(tool.State):
|
||||
self.next = c.MAIN_MENU
|
||||
self.persist = {c.CURRENT_TIME:0.0, c.LEVEL_NUM:c.START_LEVEL_NUM}
|
||||
pg.mixer.music.stop()
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.ogg"))
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.opus"))
|
||||
pg.mixer.music.play(-1, 0)
|
||||
return
|
||||
|
||||
|
||||
@ -208,5 +208,5 @@ PLANT_RECT = loadPlantImageRect()
|
||||
|
||||
# 播放音乐
|
||||
pg.mixer.init()
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,"resources", "music", "intro.ogg"))
|
||||
pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,"resources", "music", "intro.opus"))
|
||||
pg.mixer.music.play(-1, 0)
|
||||
Loading…
x
Reference in New Issue
Block a user