Physics

Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2011-08-11 16:36:21
Size: 1391
Editor: c-71-237-195-76
Comment:
Revision 3 as of 2011-08-11 16:52:07
Size: 1883
Editor: c-71-237-195-76
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
Handle for uTouch-Physics context Handle for uTouch-Physics context.

=== uphys_rect ===
Holds the origin and size of a rectangle.
Line 15: Line 18:
=== gravity === === error: int ===
Error code from last function call.

Set to 0 on success.

=== error_string: const char * ===
Error string from last function call.

Set to "no error" on success.

=== gravity: float ===
Line 18: Line 31:
=== (scrollview) viewport: uphys_rect ===
The rectangle of the viewport within the scrollview content.

=== (scrollview) content: uphys_rect ===
The rectangle of the content of the scrollview.
Line 19: Line 38:
=== uphys *uphys_new_scrollview() ===
Create a new uphys context.

Returns a new context or NULL on error.
Line 33: Line 47:

=== uphys *uphys_new_scrollview() ===
Create a new uphys context for a scrollable viewport.

Returns a new context or NULL on error.

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_rect

Holds the origin and size of a rectangle.

uphys Properties

error: int

Error code from last function call.

Set to 0 on success.

error_string: const char *

Error string from last function call.

Set to "no error" on success.

gravity: float

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.

(scrollview) viewport: uphys_rect

The rectangle of the viewport within the scrollview content.

(scrollview) content: uphys_rect

The rectangle of the content of the scrollview.

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.

Multitouch/Physics (last edited 2012-06-14 19:28:34 by c-67-170-185-42)