Difference between revisions of "Pygame"

From ArmadeusWiki
Jump to: navigation, search
(Tested pygame applications/examples)
(Tested pygame applications/examples)
Line 57: Line 57:
 
# python particleinvaders.py  
 
# python particleinvaders.py  
 
</pre>
 
</pre>
* [http://www.pygame.org/projects/7/319/ starfield rain]
+
* [http://www.pygame.org/projects/7/319/ starfield rain], to install it (assuming you have internet access on your APF):
 
<pre class="apf">
 
<pre class="apf">
 
# cd && mkdir rain && cd rain/
 
# cd && mkdir rain && cd rain/
Line 63: Line 63:
 
unzip rain.zip  
 
unzip rain.zip  
 
python rain.py  
 
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">
 +
# wget http://dchristian.co.uk/CrossFireFinal.zip
 +
# unzip CrossFireFinal.zip
 +
# cd CrossFire/
 +
# python run_game.py
 
</pre>
 
</pre>
  

Revision as of 11:23, 13 January 2012

On this page, you will find usefull informations to setup and develop pygame based applications for your Armadeus board.

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

# cd
# wget http://www.scriptedfun.com/wp-content/uploads/2006/06/arinoid.zip
# unzip arinoid.zip 
# cd arinoid/
# python arinoid.py 
# cd && mkdir 1945 && cd 1945/
# wget http://www.scriptedfun.com/wp-content/uploads/2006/06/1945.zip
# unzip 1945.zip 
# python 1945.py
# 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):
# 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

 # export SDL_NOMOUSE=1


Links