Wit

From WiiBrew
Jump to navigation Jump to search
WIT
General
Author(s)ahigerd
TypeFramework library
LicenceCPL
Links
Download
Source

WIT, the Wii Interface Toolkit, is an event-driven C++-based development toolkit intended for Wii software development.

The intent of WIT is to encapsulate most of the mundane details of the Wii platform behind a consistent programming interface while remaining relatively lightweight. The Wii Remote and Nunchuk, the Classic Controller, GameCube controllers, the Guitar Hero 3 controller, and the DJ Hero turntable controller are all managed through the same event system, allowing all forms of input to be handled consistently without requiring the developer to write separate code for each controller type. The Balance Board accessory is also supported. WIT's design is inclusive, allowing the developer to use native API calls and third-party libraries without restriction or interference.

A secondary goal is to be the most thoroughly documented homebrew library available. Every constant, function, and class exposed by the WIT API is fully documented.

The current implementation of WIT is based on libOGC, but the toolkit API is backend-independent and should be readily portable to the official WiiWare SDK; likewise, a desktop-based Wii simulator using native graphics and input backends (perhaps through wiiuse or simulating the Wii Remote with a mouse) would be possible.

Installing WIT

WIT only has one dependency, libOGC, which is included with devkitPro.

While WIT is under development, building from source is recommended, but binary snapshots are available. Download the binary package (be sure to get the one for the version of libOGC you have installed) and copy the contents of the include/ and lib/ directories to the usual places in your devkitPro installation.

HTML documentation is included in the binary package, in the doc/html/ directory.

Building WIT

To check out the latest WIT source code, you will need Mercurial, or you can download the latest snapshot from the Downloads page.

Compiling WIT is simply a matter of invoking make.

After WIT is compiled, you may invoke make install to copy the files into your devkitPro installation.

You may also invoke make docs to generate the HTML documentation. Building the documentation requires Doxygen.

Usage

Adding WIT to your application is simply a matter of adding -lwit to the start of the LIBS line of your Makefile. WIT also includes a sample application template in examples/template/, which contains a stub source file and a Makefile suitable for building against the installed version of WIT.

The Widgets example demonstrates many of the things a typical WIT program will do and includes comments explaining how each component fits together. Its source code is available for viewing on Bitbucket.

Other examples of WIT usage are included in the examples/ directory of the source distribution.

License

WIT is provided under the CPL.

In a nutshell, the CPL allows you to release your compiled binary under any license you want as long as you include an offer to receive the source code to the version of WIT used to build it. Unlike the LGPL, this does not include any requirement to enable the recipient to rebuild your program.

Features and Future Development

Controllers

The current (r62) version of WIT has been tested with the buttons, IR sensor, and motion sensors on the Wii Remote and Nunchuk, with the joysticks, digital buttons, and analog buttons of the Classic Controller, and with the D-pad on the GameCube controller. In theory, the joysticks, digital buttons, and analog buttons of the Guitar Hero 3 and GameCube controllers should work; these have not been tested yet. Support for the Balance Board and DJ Hero turntable are pending.

File Systems

Plans for implementing filesystem support are uncertain, but may be implemented in a media-independent abstraction layer if interest or necessity arises.

Graphics

WIT currently provides no support for decoding image files or drawing them on the screen. Support for drawing images will eventually be implemented. WIT will not provide built-in support for decoding image files, but developers are free to use libjpeg, libpng, or other libraries for decoding.

Text

WIT provides support for variable-width bitmap fonts; for efficiency, WIT has a special file format for these fonts. It is bundled with one font, Sans16, that is derived from Bitstream Vera Sans, copyright 2003 by Bitstream, Inc. See the source code (src/Sans16.cpp) for full licensing details of Sans16.

A tool for converting TrueType fonts to this format is available in the tools/font2wit directory in the source tree. Building font2wit requires Qt 4.5.0 or higher. font2wit attempts to make reasonable guesses about character kerning but the resulting resource may need some hand-tuning for optimum letter spacing.

WIT also provides a simple text console with a number of limitations. (These are the same limitations as the text console offered by libOGC.) Code written using, for example, FreeTypeGX will also work.

Sound

WIT may eventually provide some sort of sound support, but plans in this direction are uncertain.

Networking

WIT will provide event-driven network I/O.