Difference between revisions of "Pygame"
From ArmadeusWiki
(creation) |
m |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
On this page, you will find usefull informations to setup and develop pygame based applications for your Armadeus board. | On this page, you will find usefull informations to setup and develop pygame based applications for your Armadeus board. | ||
− | + | [[Image:pygame.png]] | |
− | + | ||
==Introduction== | ==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. | + | Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent [[SDL_Development|SDL]] library. This allows you to create fully featured games and multimedia programs in the [[Python_development|python language]]. |
For more informations -> http://www.pygame.org/ | For more informations -> http://www.pygame.org/ | ||
Line 14: | Line 13: | ||
$ make menuconfig | $ make menuconfig | ||
</pre> | </pre> | ||
− | and choose pygame package in:< | + | and choose pygame package in: |
− | + | <pre class="config"> | |
− | + | Package Selection for the target ---> | |
− | + | Graphic libraries and applications (graphic/text) ---> | |
− | + | ... | |
− | you can choose pygame options too; then save your configuration | + | [*] pygame |
− | + | ... | |
+ | </pre> | ||
+ | * you can choose pygame options too; then save your configuration | ||
* Regenerate your rootfs | * Regenerate your rootfs | ||
<pre class="host"> | <pre class="host"> | ||
Line 27: | Line 28: | ||
and reflash it on your board | and reflash it on your board | ||
− | == | + | ==Usage== |
− | + | * to test your pygame installation (requires a LCD with at least 640x480 pixels): | |
− | + | <pre class="apf"> | |
− | + | # cd /usr/lib/python2.7/site-packages/pygame/examples | |
− | + | # python testsprite.pyc | |
− | + | </pre> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | * | + | ===Tested pygame applications/examples=== |
+ | * [http://www.scriptedfun.com/arinoid-an-arkanoid-clone/ arinoid (simple arkanoid clone)], to install it (assuming you have internet access on your APF): | ||
<pre class="apf"> | <pre class="apf"> | ||
− | + | # cd | |
+ | # wget http://www.scriptedfun.com/wp-content/uploads/2006/06/arinoid.zip | ||
+ | # unzip arinoid.zip | ||
+ | # cd arinoid/ | ||
+ | # python arinoid.py | ||
+ | </pre> | ||
+ | * [http://www.scriptedfun.com/1945-a-vertical-scrolling-shooter/ 1945 (simple 1942 clone)], to install it (assuming you have internet access on your APF): | ||
+ | <pre class="apf"> | ||
+ | # cd && mkdir 1945 && cd 1945/ | ||
+ | # wget http://www.scriptedfun.com/wp-content/uploads/2006/06/1945.zip | ||
+ | # unzip 1945.zip | ||
+ | # python 1945.py | ||
+ | </pre> | ||
+ | * [http://www.scriptedfun.com/particle-effects-for-games/ particleinvaders (simple Space Invaders clone)], to install it (assuming you have internet access on your APF): | ||
+ | <pre class="apf"> | ||
+ | # mkdir invaders && cd invaders/ | ||
+ | # wget http://www.scriptedfun.com/wp-content/uploads/2007/03/particleinvaders.zip | ||
+ | # unzip particleinvaders.zip | ||
+ | # python particleinvaders.py | ||
+ | </pre> | ||
+ | * [http://www.pygame.org/projects/7/319/ starfield rain], to install it (assuming you have internet access on your APF): | ||
+ | <pre class="apf"> | ||
+ | # cd && mkdir rain && cd rain/ | ||
+ | http://www.scriptedfun.com/wp-content/uploads/2006/10/rain.zip | ||
+ | unzip rain.zip | ||
+ | python rain.py | ||
+ | </pre> | ||
+ | * [http://www.pygame.org/project-CrossFire-1825-.html CrossFire], , to install it (assuming you have internet access on your APF and ALSA up and running): | ||
+ | <pre class="apf"> | ||
+ | # cd | ||
+ | # wget http://dchristian.co.uk/CrossFireFinal.zip | ||
+ | # unzip CrossFireFinal.zip | ||
+ | # cd CrossFire/ | ||
+ | # python run_game.py | ||
</pre> | </pre> | ||
− | ==Adding Tslib (Touchscreen library) support to | + | ===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 | Tslib envt variables]] set): | |
<pre class="apf"> | <pre class="apf"> | ||
export SDL_MOUSEDRV=TSLIB | export SDL_MOUSEDRV=TSLIB | ||
Line 51: | Line 81: | ||
</pre> | </pre> | ||
− | == | + | ==Troubleshots== |
− | + | * Screen/backlight goes black after SDL launch/exit: [[BackLight|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: |
− | * If SDL is complaining because it can't find any mouse (''Unable to init SDL: Unable to open mouse'') then, before launching the program, do: | + | |
<pre class="apf"> | <pre class="apf"> | ||
# export SDL_NOMOUSE=1 | # export SDL_NOMOUSE=1 | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Links== | ==Links== | ||
Line 69: | Line 92: | ||
* [http://www.pygame.org/ pygame website] | * [http://www.pygame.org/ pygame website] | ||
− | + | [[Category:Python]] | |
− | + | [[Category:SDL]] | |
− | + | ||
− | [[Category: | + | |
[[Category:Graphical User Interface]] | [[Category:Graphical User Interface]] | ||
− | [[Category: | + | [[Category:Software]] |
Latest revision as of 12:35, 21 July 2014
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):
# cd # 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):
# cd && mkdir 1945 && cd 1945/ # wget http://www.scriptedfun.com/wp-content/uploads/2006/06/1945.zip # unzip 1945.zip # python 1945.py
- particleinvaders (simple Space Invaders clone), to install it (assuming you have internet access on your APF):
# mkdir invaders && cd invaders/ # wget http://www.scriptedfun.com/wp-content/uploads/2007/03/particleinvaders.zip # unzip particleinvaders.zip # python particleinvaders.py
- starfield rain, to install it (assuming you have internet access on your APF):
# cd && mkdir rain && cd rain/ http://www.scriptedfun.com/wp-content/uploads/2006/10/rain.zip unzip rain.zip python rain.py
- CrossFire, , to install it (assuming you have internet access on your APF and ALSA up and running):
# cd # wget http://dchristian.co.uk/CrossFireFinal.zip # unzip CrossFireFinal.zip # cd CrossFire/ # python run_game.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