Elements: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Undo revision 235268 by 123.53.123.179 (Talk))
(Undo revision 235266 by 123.53.123.179 (Talk))
Line 30: Line 30:




== Pygame Example ==
We have <a href="http://www.famousbrandshop.com/">Christian Louboutin</a>selected<a href="http://abercrombie-worlds.com/">cheap abercrombie</a> three <a href="http://greattiffanyjewelry.com/">fashion Tiffany</a>of my <a href="http://www.msmrshopping.com/">snow boots</a>personal<a href="http://www.sportjerseyssale.com/">jerseys on sale</a> favorite <a href="http://www.sportjerseyssale.com/mlb-jerseys-c-4.html">MLB Jerseys</a>styles <a href="http://www.famousbrandshop.com/Christian-Louboutin-Sandals/c6/index.html">Christian Louboutin Sandals</a>that <a href="http://www.famousbrandshop.com/Christian-Louboutin-Boots/c3/index.html">Christian Louboutin Boots</a>will <a href="http://abercrombie-worlds.com/Abercrombie-Women-Polos/c23/index.html">Abercrombie Women Polos</a>help you <a href="http://abercrombie-worlds.com/Abercrombie-Men-Classic-Shirts/c19/index.html">Abercrombie Men Classic Shirts</a>gain <a href="http://greattiffanyjewelry.com/Tiffany-&amp;-Co.-Chains/c15/index.html">Tiffany & Co. Chains</a>a new <a href="http://greattiffanyjewelry.com/Tiffany-&amp;-Co.-Cufflinks/c16/index.html">Tiffany & Co. Cufflinks</a>love <a href="http://www.msmrshopping.com/UGG-Australia-Women&#39;s-Gissella/c30/index.html">UGG Australia Womens Gissella</a>for an <a href="http://www.msmrshopping.com/UGG-Australia-Women&#39;s-Highkoo/c31/index.html">UGG Australia Womens Highkoo</a>accessory like a purse<a href="http://abercrombie-worlds.com/Abercrombie-Women-Fur-Hoodies/c21/index.html">Abercrombie Women Fur Hoodies</a>. The very <a href="http://www.msmrshopping.com/UGG-Australia-Women&#39;s-Sandals/c5/index.html">UGG Australia Women's Sandals</a>first of<a href="http://www.famousbrandbag.com/">Fake Handbags</a> the three <a href="http://www.famousbrandbag.com/">Discount Handbags</a>unique handbags<a href="http://www.famousbrandbag.com/Balenciaga/c30/index.html">Balenciaga handbags</a> is the <a href="http://www.famousbrandbag.com/Cartier/c44/index.html">Cartier handbags</a>Hobo. This<a href="http://www.famousbrandbag.com/Chloe/c31/index.html">Chloe handbags</a> particular bag <a href="http://www.famousbrandbag.com/Bally/c37/index.html">Bally handbags</a>is fantastic<a href="http://www.famousbrandbag.com/Givenchy/c45/index.html">Givenchy handbags</a>as it offers a youthful <a href="http://www.famousbrandbag.com/Mulberry/c38/index.html">Mulberry handbags</a>style in a very casual style.
''The typical usage in pygame can look like this:''
<a href="http://brandstore666.com/Famous-Gucci-Snake-Leather-Shopping-Bag-Silver-178652_p4820.html">Famous Gucci Snake Leather ShoppingBag-Silver 178652</a>

<a href="http://brandstore666.com/Famous-Gucci-Wrinkle-Japannned-Cowhide-Leather-Bag-Black-177139_p4795.html">Famous Gucci WrinkleJapannned Cowhide Leather Bag-Black 177139</a>
import pygame
<a href="http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Beige-189019_p4910.html">Famous Guccic Cowhide Embossed Bag-Beige189019</a>
from pygame.locals import *
<a href="http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Black-189019_p4906.html">Famous Guccic Cowhide Embossed Bag-Black189019</a>
from pygame.color import *
<a href="http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Light-Coffee-189019_p4915.html">Famous Guccic Cowhide EmbossedBag-Light Coffee 189019</a>
<a href="http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Offwhite-189019_p4908.html">Famous Guccic Cowhide EmbossedBag-Offwhite 189019</a>
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]]

Revision as of 23:56, 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


We have [url=http://www.famousbrandshop.com/]Christian Louboutin[/url]selected[url=http://abercrombie-worlds.com/]cheap abercrombie[/url] three [url=http://greattiffanyjewelry.com/]fashion Tiffany[/url]of my [url=http://www.msmrshopping.com/]snow boots[/url]personal[url=http://www.sportjerseyssale.com/]jerseys on sale[/url] favorite [url=http://www.sportjerseyssale.com/mlb-jerseys-c-4.html]MLB Jerseys[/url]styles [url=http://www.famousbrandshop.com/Christian-Louboutin-Sandals/c6/index.html]Christian Louboutin Sandals[/url]that [url=http://www.famousbrandshop.com/Christian-Louboutin-Boots/c3/index.html]Christian Louboutin Boots[/url]will [url=http://abercrombie-worlds.com/Abercrombie-Women-Polos/c23/index.html]Abercrombie Women Polos[/url]help you [url=http://abercrombie-worlds.com/Abercrombie-Men-Classic-Shirts/c19/index.html]Abercrombie Men Classic Shirts[/url]gain [url=http://greattiffanyjewelry.com/Tiffany-&-Co.-Chains/c15/index.html]Tiffany & Co. Chains[/url]a new [url=http://greattiffanyjewelry.com/Tiffany-&-Co.-Cufflinks/c16/index.html]Tiffany & Co. Cufflinks[/url]love [url=http://www.msmrshopping.com/UGG-Australia-Women's-Gissella/c30/index.html]UGG Australia Womens Gissella[/url]for an [url=http://www.msmrshopping.com/UGG-Australia-Women's-Highkoo/c31/index.html]UGG Australia Womens Highkoo[/url]accessory like a purse[url=http://abercrombie-worlds.com/Abercrombie-Women-Fur-Hoodies/c21/index.html]Abercrombie Women Fur Hoodies[/url]. The very [url=http://www.msmrshopping.com/UGG-Australia-Women's-Sandals/c5/index.html]UGG Australia Women's Sandals[/url]first of[url=http://www.famousbrandbag.com/]Fake Handbags[/url] the three [url=http://www.famousbrandbag.com/]Discount Handbags[/url]unique handbags[url=http://www.famousbrandbag.com/Balenciaga/c30/index.html]Balenciaga handbags[/url] is the [url=http://www.famousbrandbag.com/Cartier/c44/index.html]Cartier handbags[/url]Hobo. This[url=http://www.famousbrandbag.com/Chloe/c31/index.html]Chloe handbags[/url] particular bag [url=http://www.famousbrandbag.com/Bally/c37/index.html]Bally handbags[/url]is fantastic[url=http://www.famousbrandbag.com/Givenchy/c45/index.html]Givenchy handbags[/url]as it offers a youthful [url=http://www.famousbrandbag.com/Mulberry/c38/index.html]Mulberry handbags[/url]style in a very casual style. [url=http://brandstore666.com/Famous-Gucci-Snake-Leather-Shopping-Bag-Silver-178652_p4820.html]Famous Gucci Snake Leather ShoppingBag-Silver 178652[/url] [url=http://brandstore666.com/Famous-Gucci-Wrinkle-Japannned-Cowhide-Leather-Bag-Black-177139_p4795.html]Famous Gucci WrinkleJapannned Cowhide Leather Bag-Black 177139[/url] [url=http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Beige-189019_p4910.html]Famous Guccic Cowhide Embossed Bag-Beige189019[/url] [url=http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Black-189019_p4906.html]Famous Guccic Cowhide Embossed Bag-Black189019[/url] [url=http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Light-Coffee-189019_p4915.html]Famous Guccic Cowhide EmbossedBag-Light Coffee 189019[/url] [url=http://brandstore666.com/Famous-Guccic-Cowhide-Embossed-Bag-Offwhite-189019_p4908.html]Famous Guccic Cowhide EmbossedBag-Offwhite 189019[/url]

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)