swing

Location

$REVOLUTION_SDK_ROOT/build/demos/kpaddemo

Description

In this demo, the program recognizes the direction in which the Wii Remote is swung and displays that direction as an arrow on the TV screen.

Note: Swing the Wii Remote in such a way that its top side (the side with the A Button) remains parallel to the floor. If you tilt the Wii Remote when you swing it, the program will not recognize the correct direction.

Source File Composition

swing.c This source file contains the algorithm for detecting the direction of swing. It is possible to adjust the "feel" of recognition by editing the values of macro constants defined in this file.
graphic.h
graphic.c
The collection of subroutines for simple graphics drawing.
kfont.h
kfont.c
The collection of subroutines that display text and values on the screen.

Explanation of swing.c

The following table shows simple descriptions of the functions defined in swing.c.

init_sample() Function that initializes load settings and other settings for KPAD acceleration data
work_sample() Function that is called once per game frame to perform recognition processing
draw_sample() This function draws the result of recognition.

Note

See Also

None.

Revision History

2007/04/11 Used red letters to emphasize the note giving conditions for correct recognition.
2007/03/05 Included example parameter settings for detecting weak swings.
2007/03/02 Initial version.


CONFIDENTIAL