Pymunx: Difference between revisions

From OLPC
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 3: Line 3:
<div><div style="float:left;width:100px;">[[Image:Pymunx_80px.png]]</div>
<div><div style="float:left;width:100px;">[[Image:Pymunx_80px.png]]</div>
''pymunx'' is an API for easily integrating physics into python (pygame), using chipmunks physics engine with the pymunk bindings. (see [[Python Physics]] for more infos.)</div>
''pymunx'' is an API for easily integrating physics into python (pygame), using chipmunks physics engine with the pymunk bindings. (see [[Python Physics]] for more infos.)</div>





== Status ==
== Status ==
The status is early and experimental, but already testable. Many functions of pymunk are not yet implemented, I'm quite on it and will post updates frequently the next time, so check back often :) I'll post my updates and demos here, on http://www.linuxuser.at/pymunx, and there's also a [http://www.slembcke.net/forums/viewforum.php?f=6 forum] shared with pymunk and chipmunk.
The status is early and experimental, but already testable. Many functions of pymunk are not yet implemented, I'm quite on it and will post updates frequently the next time, so check back often :) I'll post my updates and demos here, on http://www.linuxuser.at/pymunx, and there's also a [http://www.slembcke.net/forums/viewforum.php?f=6 forum] shared with pymunk and chipmunk.


== Documentation ==
* [[Pymunx/Documentation]]
* [http://www.linuxuser.at/pymunx/pymunx.py pymunx.py] also has a doc and short ref included



== Sources ==
== Sources ==
Line 17: Line 24:
* [http://linuxuser.at/pymunx/pymunx_demo3_addmany.py pymunx_demo3_addmany.py]
* [http://linuxuser.at/pymunx/pymunx_demo3_addmany.py pymunx_demo3_addmany.py]
* [http://linuxuser.at/pymunx/pymunx_demo4_drawpoly.py pymunx_demo4_drawpoly.py]
* [http://linuxuser.at/pymunx/pymunx_demo4_drawpoly.py pymunx_demo4_drawpoly.py]



== Download ==
== Download ==
Line 22: Line 30:
svn checkout http://pymunk.googlecode.com/svn/trunk/ pymunk-read-only
svn checkout http://pymunk.googlecode.com/svn/trunk/ pymunk-read-only


== Documentation ==
* [[Pymunx/Documentation]]
* [http://www.linuxuser.at/pymunx/pymunx.py pymunx.py] also has a doc and short ref included


== pyGame Example ==
== pyGame Example ==

Revision as of 20:19, 8 March 2008

About

Pymunx 80px.png
pymunx is an API for easily integrating physics into python (pygame), using chipmunks physics engine with the pymunk bindings. (see Python Physics for more infos.)


Status

The status is early and experimental, but already testable. Many functions of pymunk are not yet implemented, I'm quite on it and will post updates frequently the next time, so check back often :) I'll post my updates and demos here, on http://www.linuxuser.at/pymunx, and there's also a forum shared with pymunk and chipmunk.


Documentation


Sources

API class with documentation

  • pymunx.py (the api class with all documentation)

Examples


Download

You can get the latest pymunx api class and examples (bundled with pymunk, in examples/) with svn:

svn checkout http://pymunk.googlecode.com/svn/trunk/ pymunk-read-only


pyGame Example

The typical usage in pygame looks like this:

      import pygame
      from pygame.locals import *
      from pygame.color import *   

      from pymunx import *
       
      pygame.init()
      screen = pygame.display.set_mode((800, 800))
      clock = pygame.time.Clock()

      world = pymunx()
      world.add_wall((100, 200), (300, 200))
         
      # Main Game Loop:
      while running:
         # Event Handling
         # Maybe calling world.add_ball(event.pos) or world.add_square(event.pos)
         # ...

         screen.fill((255,255,255))

         # Update & Draw World
         world.update()
         world.draw(screen)

         # Flip Display
         pygame.display.flip()
          
         # Try to stay at 50 FPS
         clock.tick(50)