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

Adding another platform #15

Closed
Gadgetoid opened this issue Sep 27, 2021 · 2 comments
Closed

Adding another platform #15

Gadgetoid opened this issue Sep 27, 2021 · 2 comments

Comments

@Gadgetoid
Copy link

Gadgetoid commented Sep 27, 2021

How would I go about adding PicoSystem as an additional platform to ugame? I started by copying and pasting one of the existing platforms and making some minor tweaks therein, and that seems to work.

However, it looks like there are distinct stage.py files for each platform. Which one is the source of truth?

In my case I'll probably also need to shim out a custom audio engine, since the tiny piezo doesn't quite handle PWM audio and is better driven with a simple single-tone PWM. Is within ugame the right place to do this?

Am I even barking up the right tree?

Edit: I've raised a PR adding DisplayIO to the PicoSystem board in CircuitPython here - adafruit/circuitpython#5398

@deshipu
Copy link
Contributor

deshipu commented Sep 27, 2021

Hi, this is great, I was planning to port Stage on the PicoSystem myself, as soon as I got my hands on one.

There is only one "real" stage.py at the root of the repository, all the others are just symbolic links to that one file, to make it easier to include it as a frozen library (the directory is then added to the board definition, like this https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk#L45).

You can have a DummyAudio in your pygame.py, like here https://github.com/python-ugame/circuitpython-stage/blob/master/itsybitsy_m4_express/ugame.py#L49-L57 if you don't want sound at all. If you want to use audiopwmio after all, then here is an example of that: https://github.com/python-ugame/circuitpython-stage/blob/master/meowbit/ugame.py#L55-L74

If you want to implement your own way of making sounds, that is incompatible with all the other boards that use Stage, I would recommend doing that as a completely separate library, and letting the game author choose (for example, they could then try to import your library, and if that fails, fall back to Stage's audio object).

I haven't seen your displayio pull request before, as I'm on a vacation right now and have worse access to the Internet, I agree that you probably want to use the keypad module instead of gamepad/gamepadshift. You can see the examples of changes required in ugame.py for this here: b014aa0 and here: a895b3a

Let me know if I can help in any way.

@Gadgetoid
Copy link
Author

Hi, this is great, I was planning to port Stage on the PicoSystem myself, as soon as I got my hands on one.

I can certainly make that happen sooner rather than later if you want to play.

There is only one "real" stage.py at the root of the repository, all the others are just symbolic links to that one file

I completely missed this! And - of course - completely broke it when hacking on a copy of stage.py for picosystem.

I agree that you probably want to use the keypad module

I'll look into it! Thank you.

In the mean time, enjoy your vacation!

@deshipu deshipu closed this as completed Nov 1, 2021
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

No branches or pull requests

2 participants