SDL-Demos (mostly for developers)

In order to help Delphi and pascal developers getting started with the Newton Game Dynamics Engine I wrote some demos that come with full source code so you can see how different things can be achieved when using Newton. The demos use the Simple Direct Medialayer so that, when using a cross-platform pascal compiler, you can use Newton with all operating systems that are supported by Newton itself (currently Windows, Linux and Mac) . What you need to compile and run them :

  * A compatible pascal compiler, tested with [Free Pascal 2.0.0]( and [Delphi](
  * The [Newton headers](/?page_id=76).  Choose the headers depending on which version of the demo you want to compile. The demos that use 2.00 work with the beta headers.
  * Pascal translation of the SDL-headers, called [JEDI SDL](
  * Newton's shared library for your operating system, included in the [Newton SDK](, placed somewhere where the application can find it
  * [SDL's shared library]( for your operating system, placed somewhere where the application can find it
![Newton SDL 01](/images/thumb_sdl1.jpg) **01 - Basic Demo** This is as basic as it can get. If you want to get into the usage of Newton, take a look at this demo. It shows how to create some spinning boxes and also shows you how correct physics timing is done using "accumulative timeslicing". * [Source (Newton 2.32)]( * [Source (Newton 1.53)](
![Newton SDL 02](./images/thumb_sdl2.jpg) **02 - Joints Demo** This demo shows off all different joint types that Newton has to offer : Ball and Socket, Hinge, Slider, Corkscrew and the universal joint. It also shows how to use newton's raycast-functions to grab and influence bodies. Also shows how to display debug lines for physics. * [Source (Newton 2.32) * [Source (Newton 1.53)](
![Newton SDL 03](./images/thumb_sdl3.jpg) **03 - Vehicle Demo** This demo shows how to use the vehicle container in Newton. It isn't looking pretty, but the source is fully documented and it should be easy to get vehicles to run in your own applications. * [Source (Newton 1.53)]( * _No Newton 2.00 source yet. Vehicle functions are missing from current NGD 2.xx beta!_
![Newton SDL 04](./images/thumb_sdl4.jpg) **04 - Buoyancy Demo** This demonstration shows you how to implement fluids (and similar things) that bodies are immersed in using newton's buoyancy features. * [Source (Newton 2.32)]( * [Source (Newton 1.53)](
![Newton SDL 05](./images/thumb_sdl5.jpg) **05 - Ragdoll Demo** This demo shows the usage of NGD's RagDoll-container to create humanoid ragdolls that bend and twist like real corpses do. The demo let's you drop them down on an environment and also let's you grab and throw them around with your mouse. * [Source (Newton 1.53)]( * _No Newton 2.00 source yet. Ragdoll functions are still subject to change in NGD 2.xx beta!_
![Newton SDL 06](./images/thumb_sdl6.jpg) **06 - Character Controller** When pepople think of physics engines like NGD, they first think about throwing objects around. But that's not the only thing such a physics engine can be used for. Modern FPS-games need to have robust collisions with realistic movement and collision reaction. This is usually a hard thing to code, but Newton can easily be used to implement such a character controller. This demo shows how to do this and let's you run around in a small FPS environment where you can even interact with some dynamic objects. * [Source (Newton 2.32)]( * [Source (Newton 1.53)](
![Newton SDL 07](./images/thumb_sdl7.jpg) **07 - Simple explosion** This demo shows how to create (simple explosions) by adding impulse to all bodies in an explosions perimeter depending on their distance to the explosions origin. * [Source (Newton 2.33)](
![Newton SDL 08](./images/thumb_sdl8.jpg) **08 - Contact process callback** Newton's material system is very sophisticated and offers a lot possibilites. One of these is the contact process callback, a callback called from inside newton when two materials generate contacts. In this callback you can get the force of a contact and use it to apply damage, spawn particles, or play sounds depending on the strength of that contact, which is shown in this demo. * [Source (Newton 2.33)](
![Newton SDL 09](./images/thumb_sdl9.jpg) **09 - Moving static bodies** Sometimes it may be necessary to move a static body, for example if you have a scripted object that only moves when a certain action is triggered (think of an elevator for example). Just overriding the matrix of this body with animation information won't work as interaction with rigid bodies won't be correct. This demo shows how to move static objects the correct way. * [Source (Newton 2.33)](