Elements: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (New page: Image:Elements_banner1.jpg The ''Elements'' project is all about '''free and easy 2D physics''' -- with main attention on: # An easy-to-use 2D Physics API for Python # Examples and D...)
 
(Undo revision 235268 by 123.53.123.179 (Talk))
 
(45 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<div style="float:right">__TOC__</div>
[[Image:Elements_banner1.jpg]]
[[Image:Elements_logo1.png]]


== About ==
The ''Elements'' project is all about '''free and easy 2D physics for python''' and the XO laptop. It is used as the backend for the XO physics playground activity [[Physics]].


The ''Elements'' project is all about '''free and easy 2D physics''' -- with main attention on:
# An easy-to-use 2D Physics API for Python
# Examples and Documentation on how to use the API
# Speed (also for the XO Laptop)
# Development of ideas for education and playful-learning


: '''Watch [http://www.youtube.com/watch?v=NZNTgglPbUA this] and [http://www.youtube.com/watch?v=QsTqspnvAaI that] video to see where we are heading


: IRC: '''#elements''' on irc.freenode.net
'''More Informations'''

* IRC: #elements on irc.freenode.net

* Project started by [[User:Crazy-chris|Chris Hager]], March 2008. Source-Code is GPL licensed - so do with it what you want! Even eat it :)
: <big>Homepage: http://elements.linuxuser.at</big>
* 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 ...)
== Screenshots ==
* Communication to the chipmunk library is done via the pymunk ctypes bindings (by Victor Blomqvist.)
''(from [[Elements/Screenshots]])''
* A lively and open development and support team is having fun improving and helping out :)

[[Image:Screenshot1.png|400px]] [[Image:Screenshot2.png|400px]]

[[Image:Screenshot3.png|400px]] [[Image:Screenshot4.png|400px]]


== 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)

[[category:software ideas]]
[[category:physics]]
[[category:science]]

Latest revision as of 23:57, 18 May 2010

Elements logo1.png

About

The Elements project is all about free and easy 2D physics for python and the XO laptop. It is used as the backend for the XO physics playground activity Physics.


Watch this and that video to see where we are heading
IRC: #elements on irc.freenode.net


Homepage: http://elements.linuxuser.at

Screenshots

(from Elements/Screenshots)

Screenshot1.png Screenshot2.png

Screenshot3.png Screenshot4.png


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)