Skip to content

Commit

Permalink
feat: pygbag example
Browse files Browse the repository at this point in the history
  • Loading branch information
Rabbid76 committed Jan 24, 2024
1 parent 38093ad commit 03550c5
Show file tree
Hide file tree
Showing 9 changed files with 561 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ The site is still under construction :construction:.

[Code snippets](documentation/pygame/pygame_code_snippets.md)

[Ruun pygame in a web browser](documentation/pygame/pygame_in_web_browser.md)

## Libraries

[PyGame and PyMunk](documentation/pygame/pygame_and_pymunk.md)
Expand All @@ -272,4 +274,3 @@ See [PyGame Ray Tracing](https://github.com/Rabbid76/PyGameRayTracing) repositor
[Github - pygame](https://github.com/pygame/)
[Github - pygame/pygame](https://github.com/pygame/pygame)
[GitHub - CTPUG/pygame_cffi](https://github.com/CTPUG/pygame_cffi)

24 changes: 24 additions & 0 deletions documentation/pygame/pygame_in_web_browser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[![StackOverflow](https://stackexchange.com/users/flair/7322082.png)](https://stackoverflow.com/users/5577765/rabbid76?tab=profile)            [![reply.it](../../resource/logo/Repl_it_logo_80.png) reply.it](https://repl.it/repls/folder/PyGame%20Examples)

---

# Run Pygame in a browser

## Pygbag

[pip pygbag](https://pypi.org/project/pygbag/)

:scroll: **[minimal example - Pygbag](../../examples/minimal_exmaples_web/pygame_minimal_move_object/main.py)**

```bash
pip3 install pygbag --user --upgrade
pygbag your.app.folder
```

## Resources

- [How do I integrate pygame game into flask webapp?](https://stackoverflow.com/questions/66774076/how-do-i-integrate-pygame-game-into-flask-webapp)
- [pygame-web.github.io](https://pygame-web.github.io/)
- [pygame-web.github.io - CPython Wasm specifics](https://pygame-web.github.io/wiki/python-wasm/)
- [pygame-web.github.io - Python code specifics](https://pygame-web.github.io/wiki/pygbag-code/)
- [https://www.youtube.com/watch?v=6PhDmpBcezQ]
2 changes: 1 addition & 1 deletion documentation/pygame/pygame_sprite_and_sprite_mask.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Related Stack Overflow questions:
- [Play animation upon collision with enemy](https://stackoverflow.com/questions/61964552/play-animation-upon-collision-with-enemy/61968944#61968944)
- [trying to get sprite to disappear from screen after certain amount of time](https://stackoverflow.com/questions/62614228/trying-to-get-sprite-to-disappear-from-screen-after-certain-amount-of-time/62614388#62614388)
- [Animated sprite from few images](https://stackoverflow.com/questions/14044147/animated-sprite-from-few-images/64668964#64668964)
c
For an animated _Sprite_ a list of images ([`pygame.Surface`](https://www.pygame.org/docs/ref/surface.html) objects) must be generated. A different picture of the list is displayed in each frame, just like in the pictures of a movie. This gives the appearance of an animated object.
One way to get a list of images is to load an animated [_GIF_ (Graphics Interchange Format)](https://de.wikipedia.org/wiki/Graphics_Interchange_Format). Unfortunately, PyGame doesn't offer a function to load the frames of an animated GIF. However, there are several Stack Overflow answers that address this issue:
Expand Down
1 change: 1 addition & 0 deletions examples/minimal_exmaples_web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web-cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.8.6
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 03550c5

Please sign in to comment.