Skip to main content

PyGame wasm for everyone

Reason this release was yanked:

pre alpha

Project description

pygbag

PyGame wasm for everyone ( packager + test server )

"your_game_folder" must contains a main.py and its loop must be async aware eg :

import asyncio
import pygame

pygame.init()
pygame.display.set_mode((320, 240))
pygame.display.set_caption("TEST")


async def main():
    count = 3

    while True:
        print(f"""


    Hello[{count}] from Pygame


""")
        pygame.display.update()
        await asyncio.sleep(0)

        if not count:
            pygame.quit()
            return
        count = count - 1


asyncio.run( main() )

usage:

`pip3 install pygbag --upgrade`
`pygbag your_game_folder`

command help: pygbag --help your_game_folder

usage: __main__.py [-h] [--bind ADDRESS] [--directory DIRECTORY]
                   [--cache CACHE] [--cdn CDN] [--template TEMPLATE]
                   [--ssl SSL] [--port [PORT]]

optional arguments:
  -h, --help            show this help message and exit
  --bind ADDRESS        Specify alternate bind address [default: localhost]
  --directory DIRECTORY
                        Specify alternative directory
                        [default: <your_game_folder>/build/web]
  --cache CACHE         md5 based url cache directory
  --cdn CDN             web site to cache locally
                        [default:https://pmp-p.github.io/pygbag/]
  --template TEMPLATE   index.html template
  --ssl SSL             enable ssl with server.pem and key.pem
  --port [PORT]         Specify alternate port [default: 8000]

Now navigate to http://localhost:8000 with a modern Browser v8 based browser are preferred ( chromium/brave/chrome ... ) because imposing some baseline restrictions on WebAssembly loading.

NOTES:

  • first load will be slower, because setting up local cache from cdn to avoid useless network transfer for getting pygame and cpython prebuilts.

  • each time changing code/template you must restart pygbag your_game_folder but cache is not destroyed.

  • if you want to reset prebuilts cache, remove the build/web-cache folder in your_game_folder

support via Discord:

https://discord.gg/t3g7YjK7rw   ( #pygame-web on Pygame Community )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygbag-0.0.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygbag-0.0.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file pygbag-0.0.1.tar.gz.

File metadata

  • Download URL: pygbag-0.0.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for pygbag-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d0c3428d8242c93d2b0ee2423e15a2e1481961962e7caf5ac7a84dae6a372ff6
MD5 52d94acb0a54fa631257131704ad7a5b
BLAKE2b-256 c28dc18fd0d396d9b44a0556e2f07d09f39bafbe09ffe0f2b3681c90b3745e9b

See more details on using hashes here.

File details

Details for the file pygbag-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pygbag-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for pygbag-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d1163f98d43466cd42be7d2b16a248800d4fce2f4df66705ccb30316c0c56b
MD5 3bc44af638407baf0f5ef7704d8273ca
BLAKE2b-256 3ad005bdd2a10beca07f86c3d5bc5380acb5cecab76506cffc4e70b263bab105

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page