Pygame
From ArmadeusWiki
On this page, you will find usefull informations to setup and develop pygame based applications for your Armadeus board.
Contents
Introduction
Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language.
For more informations -> http://www.pygame.org/
Installation
- Launch Buildroot configuration
$ make menuconfig
and choose pygame package in:
Package Selection for the target ---> Graphic libraries and applications (graphic/text) ---> ... [*] pygame ...
- you can choose pygame options too; then save your configuration
- Regenerate your rootfs
$ make
and reflash it on your board
Usage
- to test your pygame installation (requires a LCD with at least 640x480 pixels):
# cd /usr/lib/python2.7/site-packages/pygame/examples # python testsprite.pyc
Tested pygame applications/examples
- arinoid (simple arkanoid clone), to install it (assuming you have internet access on your APF):
# mkdir arinoid && cd arinoid # wget http://www.scriptedfun.com/wp-content/uploads/2006/06/arinoid.zip # unzip arinoid.zip # cd arinoid/ # python arinoid.py
- 1945 (simple 1942 clone), to install it (assuming you have internet access on your APF):
# mkdir arinoid && cd arinoid # wget http://www.scriptedfun.com/wp-content/uploads/2006/06/1945.zip # unzip 1945.zip # python 1945.py
Adding Tslib (Touchscreen library) support to pygame
You just have to make SDL knows the presence of Tslib when launching your application (assuming you have correct Tslib envt variables set):
export SDL_MOUSEDRV=TSLIB export SDL_MOUSEDEV=$TSLIB_TSDEVICE
Troubleshots
- Screen/backlight goes black after SDL launch/exit: use backlight driver to set backlight to a default value.
- If SDL is complaining because it can't find any mouse (Unable to init SDL: Unable to open mouse) and you don't have one, then, before launching the program, do:
# export SDL_NOMOUSE=1