Skip to content

pygame-ce getting started and timing tutorial #183

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gillius
Copy link

@gillius gillius commented Jun 19, 2025

Small update to configuration section to note that <py-config> applies only to py/mpy type scripts.

Major additions to pygame-ce.md on how to get started by explaining the changes needed from "stock" pygame-ce code to run in pyscript, and specifically ways to allow the same code to run cross-platform (locally and in pyscript online).

Example code listed in documentation is live at https://gillius.pyscriptapps.com/pyscript-pygame-ce-quickstart/latest/. If it's appropriate and desired, I can provide each variation for your upload https://docs.pyscript.net/2025.5.1/examples/.

I have written all documentation myself and contribute it under Apache 2.0 license as per https://docs.pyscript.net/2025.5.1/contributing/. The source code for the example is pulled from https://pyga.me/docs/tutorials/en/intro-to-pygame.html (source) with modifications to run under pyscript made by myself. The original code is documented as authored by Pete Shinners ([email protected]). The pygame-ce docs folder readme doesn't list a license but there is a file LGPL.txt which implies it may be covered by LGPL.

As an example of 18 straightforward lines of code I would assume usage would be fair use, but if you want me to build a novel example I can. I used this one due to its small size and to show directly how we can modify pygame getting started documentation to work on pyscript.

Small update to configuration section to note that `<py-config>` applies
only to py/mpy type scripts.

Major additions to `pygame-ce.md` on how to get started by explaining
the changes needed from "stock" pygame-ce code to run in pyscript, and
specifically ways to allow the same code to run cross-platform (locally
and in pyscript online).
@gillius
Copy link
Author

gillius commented Jun 19, 2025

I followed the documentation to create a venv and tested local rendering of the documentation via mkdocs serve and viewing it on localhost.

@WebReflection
Copy link
Contributor

This is lovely, thank you a lot!!! I think everything you wrote is sound and useful but I'd like to wait for @ntoll eyes because he's the native English speaker so he might spot some gotcha I didn't but, for the time being, you have my approval, I wish we had more contributions like this one 💖

Copy link
Contributor

@WebReflection WebReflection left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for @ntoll to double check but I think this should go in as it provides tons of tiny details we didn't formalize before.

@gillius
Copy link
Author

gillius commented Jun 20, 2025

Thanks for the approval and kind words. After a re-read today I did fix a grammar issue and removed a reference to "earlier code using dt" which existed while I was drafting the doc but removed in the end (but forgot to remove the later reference to it).

* `configuration.md` fix grammar ("For these set the config attribute
  method" -> "For these use the config attribute method")
* `pygame-ce.md` Removed "Our usage of `clock.tick()` and `dt` in the
  earlier code" which referenced removed code that existed earlier.
@gillius gillius force-pushed the pygame-getting-started branch from 55e4eb2 to ffce2b4 Compare June 20, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants