Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio should now work on web version #11

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:

- name: Build the site
run: |
wget https://github.com/electronstudio/pygbag-raylib/releases/download/v5.5.0.0/raylib-5.5.0.0-cp310-abi3-wasm32_bi_emscripten.whl
unzip raylib-5.5.0.0-cp310-abi3-wasm32_bi_emscripten.whl
rm raylib-5.5.0.0-cp310-abi3-wasm32_bi_emscripten.whl
wget https://github.com/electronstudio/pygbag-raylib/releases/download/v5.5.0.1/raylib-5.5.0.1-cp310-abi3-wasm32_bi_emscripten.whl
unzip raylib-5.5.0.1-cp310-abi3-wasm32_bi_emscripten.whl
rm raylib-5.5.0.1-cp310-abi3-wasm32_bi_emscripten.whl
python3 -m pygbag --build --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git main.py

- name: Upload artifact
Expand Down
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def init_gloom_shader() -> Shader:
icon = load_image(os.path.join(os.path.dirname(__file__), "icon.png"))
def setup_window():
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Tempest Raylib")
if platform.system() == "Emscripten":
platform.window.window_resize()
set_window_icon(icon)
set_target_fps(TARGET_FPS)

Expand Down Expand Up @@ -96,8 +98,7 @@ async def main():
# Engine setup
setup_window()

if platform.system() != "Emscripten": # audio does not work on current version of emscripten
init_audio_device()
init_audio_device()

sound_volume = 0.7
sound_manager = SoundManager(sound_volume)
Expand All @@ -111,7 +112,7 @@ async def main():

# Main game loop
while not window_should_close():
if is_key_pressed(KeyboardKey.KEY_F) or get_touch_point_count()>0 and not renderer.fullscreen:
if is_key_pressed(KeyboardKey.KEY_F):
renderer.toggle_fullscreen()
# Update game
game.update_frame()
Expand Down