Difference between revisions of "SDL Wii"

From WiiBrew
Jump to navigation Jump to search
m
m (link to sdl_draw)
Line 126: Line 126:
 
* [[SDL Wii/installation help]]
 
* [[SDL Wii/installation help]]
 
* [[:Category:Homebrew using SDL libraries|Homebrew using SDL libraries]]
 
* [[:Category:Homebrew using SDL libraries|Homebrew using SDL libraries]]
 +
* [[SDL_draw]]

Revision as of 17:03, 31 July 2009

SDL Wii
SDL logo.png
General
Author(s)Numerous
Maintainer(s)Tantric
TypeFramework library
Links
Download
Source

Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, and video. It is used by MPEG playback software, emulators, and many popular games. SDL is written in C, but works with C++ natively.

SDL support on Wii is currently incomplete. Although SDL is useable, you will likely experience problems until this is rectified. Please contribute any improvements you make to the SDL Wii SVN.

Usage

  • Copy all of the header files $DEVKITPRO/libogc/include/SDL/
  • Copy all of the *.a files to $DEVKITPRO/libogc/lib/wii/

Remember to link the libraries in the right order:

LIBS	:=	-lSDL_net -lSDL_ttf -lSDL_gfx -lSDL_mixer -lSDL_image -lSDL \
                -lsmpeg -ljpeg -lpng -lfreetype -ltremor \
                -lz -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard


Use your friend google to learn how to use SDL.

There is also additional installation help available.

Tutorial

A simple but currently incomplete tutorial can be found here. Made by GabberNL.

Tips

SDL Wii's video output uses GX, so you might want to disable the console output you see at bootup:

extern const devoptab_t dotab_stdnull;
devoptab_list[STD_OUT] = &dotab_stdnull;
devoptab_list[STD_ERR] = &dotab_stdnull;

Using SDL

SDL has graphics, sound, and input all in one. SDL is a very popular library used in many open source programs. It is most commonly used in games, but it is also used in emulators and media players. SDL is very easy to use and it is very easy to port apps that use it.

SDL joystick mapping

The sticks and axes are mapped this way:

SDL axis WiimoteHorizontal.svg Nunchuck alternative.svg ClassicController.svg Comments
0 (horizontal) Nunchuck Control Stick Classic Left Control Stick Only one expansion can be connected
1 (vertical) Nunchuck Control Stick Classic Left Control Stick
2 (horizontal) Classic Right Control Stick
3 (vertical) Classic Right Control Stick
4 (horizontal) Classic R Trigger
5 (vertical) Classic L Trigger

(the D-pads on the wiimote and the classic controller is mapped as a joystick "hat")

The wiimote buttons are mapped this way in SDL:

SDL button index WiimoteHorizontal.svg Nunchuck alternative.svg ClassicController.svg
0 Wiimote A Button
1 Wiimote B Button
2 Wiimote 1 Button
3 Wiimote 2 Button
4 Wiimote - Button
5 Wiimote + Button
6 Wiimote HOME Button
7 Nunchuck Z Button
8 Nunchuck C Button
9 Classic a Button
10 Classic b Button
11 Classic x Button
12 Classic y Button
13 Classic L Trigger
14 Classic R Trigger
15 Classic ZL Button
16 Classic ZR Button
17 Classic - Button
18 Classic + Button
19 Wiimote HOME Button

Bugs

  • SDL_gfx eats up memory and can cause code dumps. If you get code dumps then try removing SDL_gfx.
  • There are no other known bugs besides the ones from the original SDL.

Source

Many authors have contributed to the SDL Wii port over the years. The original source is from libSDL. A GameCube version was found in the devkitPro CVS repository. Mindcry made the port compatible with the Wii and added on sound, SDL_mixer and SDL_image. Devildante recompiled a version of SDL_image with libjpeg support, and added SDL_gfx and SDL_ttf with FreeType. Numerous changes were also made by Yohannes (threading, audio, etc), and David Hudson updated to the latest SDL SVN. Tantric has also rewritten portions, including the file access, audio, and video systems.

See Also