Physics

Revision 2 as of 2011-08-11 16:39:39

Clear message

Library: uTouch-Physics Language: C Dependencies: ODE

Units

Screen coordinates make more sense than real-world coordinates. If you have a 30" monitor next to a 24" monitor, both with equal resolutions, scrolling should move the content the same amount in screen coordinates. To facilitate this, units of pixels are used for distance.

A 24" 1080p monitor is a typical size and resolution for a desktop computer. This works out to 3614 px/m in the diagonal direction. We will assume square pixels. Thus, a reasonable conversion from meters to pixels is about 3.5 MP/m (where MP is a mega-pixel, or 1000 pixels).

Types

uphys

Handle for uTouch-Physics context

uphys Properties

gravity

Defaults to 34.3 MP/s2. This is calculated by multiplying the standard earth gravity of 9.8 m/s2 by the standard conversion from meters to pixels of 3.5 MP/m.

Functions

int uphys_set_property(uphys *uphys, const char *name, void *value)

Set a property value.

Returns 0 if successful, non-zero on error.

int uphys_get_property(const uphys *uphys, const char *name, void *value)

Get a property value.

Returns 0 if successful, non-zero on error.

uphys *uphys_new_scrollview()

Create a new uphys context for a scrollable viewport.

Returns a new context or NULL on error.