Elements: Difference between revisions
Jump to navigation
Jump to search
Crazy-chris (talk | contribs) m (correct demo links) |
Crazy-chris (talk | contribs) mNo edit summary |
||
Line 12: | Line 12: | ||
:[http:// |
:[http://www.linuxuser.at/elements/elements.zip Elements.zip] (338 kb) | [http://www.linuxuser.at/elements/elements.xo Elements.xo] (195 kb) | [[Elements/Documentation|Documentation]] | [http://www.linuxuser.at/Elements Browse Source] |
||
Revision as of 23:03, 12 March 2008
About
The Elements project is all about free and easy 2D physics for python -- with main attention on:
- An easy-to-use, fast 2D physics API for the Chipmunk 2d physics engine (with pymunk ctypes bindings)
- Examples and documentation on how to use the API
- Providing the examples as bundles, as they are already interesting and fun
- Speed optimization (also with an eye on the XO laptop :)
- Development of ideas for education and playful-learning
- Elements.zip (338 kb) | Elements.xo (195 kb) | Documentation | Browse Source
More Informations
- IRC: #elements on irc.freenode.net
- Project started by Chris Hager, March 2008. Source-Code is GPL licensed - so do with it what you want! Even eat it :)
- The Elements project derived from pymunx, which started as examples for pymunk and is growing up to a real physics api for python
- The 2D physics is handled by the chipmunk physics engine (written in C by ...)
- Communication to the chipmunk library is done via the pymunk ctypes bindings (by Victor Blomqvist.)
- A lively and open development and support team is having fun improving and helping out :)
- Features: fast, easy to use, segments, polygons, circles, colissions, variable gravity, density, mass, friction, elasticity, inertia, impulses, screenshots, screencasts, cross-platform, entertaining, fascinating, ...
- Limitations which will be implemented soon: Joints, Grouped Elements and Non-convex Polygons. Screencast encoding currently works only in linux with mencoder installed.
Screenshots
(from Elements/Screenshots)
Videos
Downloads
- File:Elements.zip (338 kb): Elements API, demos, pymunk, compiled chipmunk libs (and, for the curious, the Chipmunk sources)
- File:Elements.xo ... Demo selection bundles for the XO laptop
- svn checkout http://pymunk.googlecode.com/svn/trunk/ pymunk-read-only ... Pymunk with demos and docs
- ChipmunkLatest.tgz ... The source of the Chipmunk physics engine (written in C)
Documentations
Examples
http://www.linuxuser.at/Elements/demos Examples
- demo1_ballsnsquares.py (most simple :)
- demo2_drawwalls.py (create new walls)
- demo3_addmany.py (add more objects at once)
- demo4_drawpoly.py (draw a polygon)
- demo5_draw.py (tryout for segments (buggy))
- demo6_throw_and_settings.py (++) (adjust elasticity, density, size and throw in objects)
- demo7_elasticbox.py (++) (elastic walls all around. very funny :)
- demo8_gravityfun.py (+++) (change the gravity vector (or set to (0,0) by right mouse click)
Pygame Example
The typical usage in pygame can look like this:
import pygame from pygame.locals import * from pygame.color import * from elements import * pygame.init() screen = pygame.display.set_mode((800, 800)) clock = pygame.time.Clock() world = elements() 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)