public
Description: Small iPhone application showing some real physics.
Homepage:
Clone URL: git://github.com/drodriguez/gravity.git
Daniel Rodríguez Troitiño (author)
Fri Apr 24 00:33:53 -0700 2009
name age message
file .gitignore Mon Apr 13 09:32:08 -0700 2009 .gitignore [Daniel Rodríguez Troitiño]
directory Chipmunk/ Mon Apr 13 15:06:11 -0700 2009 Chipmunk source code. [Daniel Rodríguez Troitiño]
directory Classes/ Sun Apr 19 13:54:20 -0700 2009 5 balls on the screen. [Daniel Rodríguez Troitiño]
directory Gravity.xcodeproj/ Sun Apr 19 13:24:00 -0700 2009 Changing tiff image for png and including in re... [Daniel Rodríguez Troitiño]
file Gravity_Prefix.pch Mon Apr 13 09:31:01 -0700 2009 Initial commit. [Daniel Rodríguez Troitiño]
file Info.plist Sun Apr 19 13:54:20 -0700 2009 5 balls on the screen. [Daniel Rodríguez Troitiño]
file LICENSE Fri Apr 24 00:16:06 -0700 2009 License file. [Daniel Rodríguez Troitiño]
file MainWindow.xib Mon Apr 13 09:31:01 -0700 2009 Initial commit. [Daniel Rodríguez Troitiño]
file README.markdown Fri Apr 24 00:33:53 -0700 2009 REAME file. [Daniel Rodríguez Troitiño]
file ball.png Sun Apr 19 13:24:00 -0700 2009 Changing tiff image for png and including in re... [Daniel Rodríguez Troitiño]
file ball.xcf Fri Apr 17 16:44:25 -0700 2009 Ball with transparent background. [Daniel Rodríguez Troitiño]
file entl.plist Tue Apr 14 10:21:02 -0700 2009 AdHoc configuration. [Daniel Rodríguez Troitiño]
file main.m Mon Apr 13 09:31:01 -0700 2009 Initial commit. [Daniel Rodríguez Troitiño]
file pool-table.png Sun Apr 19 13:24:00 -0700 2009 Changing tiff image for png and including in re... [Daniel Rodríguez Troitiño]
file pool-table.xcf Fri Apr 17 14:50:24 -0700 2009 Images for pool table and ball. [Daniel Rodríguez Troitiño]
README.markdown

Gravity demo

Small iPhone and iPod touch application showning pool balls over a pool table under the influence of gravity, using the accelerometers from the device to know where the balls should fall.

Code Organization

“Classes” directory contains the code for the application, and “Chipmuck” contains the code for the Chipmuck physics library.

“Classes” directory

  • GRAppDelegate: Initialization code for the application.
  • GRController: Initialization code for the objects and physics. Drawing code for the OpenGL view. Delegate for both GREAGLView and UIAccelerator.
  • GREAGLView: Typical OpenGL view with delegate.
  • GRSprite: Common code for all sprites.
  • GRPoolTable: Builds the pool table static physics object. Optimization code for drawing the sprite on the device using DrawTex extension.
  • GRPoolTable: Build a ball physics object.
  • Texture2D: Loads images and turn them into OpenGL textures.

Work to do

  • Some kind of texture manager: right now each ball generates its own texture.
  • Better organization for the physics integration (passing around the space and static body doesn't seems right).
  • Implement the right physics: Chipmuck do not work for “over the table” physics.

Credits

Author: Daniel Rodríguez Troitiño (drodrigueztroitino thAT yahoo thOT es).

Using Chipmunk http://code.google.com/p/chipmunk-physics/ for the physics simulation. Chipmuck 4.1.0 code is included.

Using Texture2D code provided by Apple in the old sample Lunar Lander.