diff --git a/docs/beginning-pyscript.md b/docs/beginning-pyscript.md index 460d4d9..ef46c59 100644 --- a/docs/beginning-pyscript.md +++ b/docs/beginning-pyscript.md @@ -117,8 +117,8 @@ module in the document's `` tag: 🦜 Polyglot - Piratical PyScript - - + + @@ -168,8 +168,8 @@ In the end, our HTML should look like this: 🦜 Polyglot - Piratical PyScript - - + +

Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️

diff --git a/docs/user-guide/first-steps.md b/docs/user-guide/first-steps.md index ddc0005..0013235 100644 --- a/docs/user-guide/first-steps.md +++ b/docs/user-guide/first-steps.md @@ -20,9 +20,9 @@ CSS: - + - + diff --git a/docs/user-guide/plugins.md b/docs/user-guide/plugins.md index e534880..4769a44 100644 --- a/docs/user-guide/plugins.md +++ b/docs/user-guide/plugins.md @@ -100,7 +100,7 @@ For example, this will work because all references are contained within the registered function: ```js -import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js"; hooks.worker.onReady.add(() => { // NOT suggested, just an example! @@ -114,7 +114,7 @@ hooks.worker.onReady.add(() => { However, due to the outer reference to the variable `i`, this will fail: ```js -import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js"; // NO NO NO NO NO! ☠️ let i = 0; @@ -147,7 +147,7 @@ the page. ```js title="log.js - a plugin that simply logs to the console." // import the hooks from PyScript first... -import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js"; // The `hooks.main` attribute defines plugins that run on the main thread. hooks.main.onReady.add((wrap, element) => { @@ -197,8 +197,8 @@ hooks.worker.onAfterRun.add(() => { - - + + ` Now you don't even need to +`pip install` the library! It comes with PyScript by default, and you can share +your games via a URL! + +!!! Info + + Please refer to + [PyGame-CE's extensive documentation](https://pyga.me/docs/) for how to + create a game. Some things may not work because we're running in a + browser context, but play around and let us know how you get on. + +## How it works + +When a `` element is found on the page a +Pyodide instance is bootstrapped with the `pygame-ce` package already included. +Differently from other scripts, `py-game` cannot currently work through a +worker and it uses an optional target attribute to define the `` +element id that will be used to render the game. If no target attribute is +defined, the script assumes there is a `` element already +on the page. + +A config attribute can be specified to add extra packages but right now that's +all it can do. + +This is an experiment, but: + +* It is possible to use regular PyScript to load the pygame-ce package and use + all the other features. But there be dragons! This helper simply allows + multiple games on a page and forces game logic to run on the main thread to + reduce confusion around attributes and features when the `pygame-ce` package + is meant to be used. Put simply, we make it relatively safe and easy to use. +* The fact `pygame-ce` is the default "game engine" does not mean in the future + PyScript won't have other engines also available. +* Once again, as this is an experiment, we welcome any kind of feedback, + suggestions, hints on how to improve or reports of what's missing. + +Other than that, please go make and share wonderful games. We can't wait to see +what you come up with. diff --git a/docs/user-guide/workers.md b/docs/user-guide/workers.md index 27f4840..27548dc 100644 --- a/docs/user-guide/workers.md +++ b/docs/user-guide/workers.md @@ -282,9 +282,9 @@ Here's how: - + - + PyWorker - mpy bootstrapping pyodide example diff --git a/mkdocs.yml b/mkdocs.yml index 8733bc3..44eb83a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,6 +74,7 @@ nav: - The FFI in detail: user-guide/ffi.md - Python terminal: user-guide/terminal.md - Python editor: user-guide/editor.md + - PyGame-CE: user-guide/pygame-ce.md - Plugins: user-guide/plugins.md - Use Offline: user-guide/offline.md - Built-in APIs: api.md diff --git a/version.json b/version.json index 03caaca..d4e0b62 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.11.1" + "version": "2025.2.1" }