-
Notifications
You must be signed in to change notification settings - Fork 0
Screen
Boyney edited this page Feb 6, 2023
·
1 revision
Accessing the screen is the most important part of the library. Luckily, it's fairly simple to use. All you need to access is:
- The screen. This is under
Spryg.screenand is actually just a MicroPython framebuffer. You can perform all screen actions on it as described in the FrameBuffer Docs. - The flipping. This is the function
Spryg.flip, and when called it will update the screen of the Spryg with the changes you've made to the screen. If you don't run this, the screen won't work. - Optionally, the backlight. This is highly recommended because without it the screen is very hard to see. You can access it with
Spryg.backlight. It's just a MicroPython pin, so to turn it on and off you callSpryg.backlight.onandSpryg.backlight.off.
Here's an example of using the screen to show some text with a neat shadow effect:
game.py
def run(spryg):
spryg.screen.text("Hello from Spryg!", 1, 1, 0x00F8) # Shadow
spryg.screen.text("Hello from Spryg!", 0, 0, 0xFFFF) # Main text
spryg.flip() # Update the screen