Line 6:
Line 6:
| maintainer = [[User:Tantric|Tantric]]
| maintainer = [[User:Tantric|Tantric]]
| download = http://code.google.com/p/sdl-wii/downloads/list
| download = http://code.google.com/p/sdl-wii/downloads/list
−
| source = http://code.google.com/p/sdl-wii/source/checkout
+
| source = https://github.com/dborth/sdl-wii
}}
}}
Line 13:
Line 13:
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 [http://code.google.com/p/sdl-wii/source/checkout SDL Wii SVN].
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 [http://code.google.com/p/sdl-wii/source/checkout SDL Wii SVN].
−
SDL Wii supports 640X480 and 320X240 framebuffer resolution.
== Usage ==
== Usage ==
Line 43:
Line 42:
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 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 Wii supports 640X480 and 320X240 framebuffer resolution. The default bitdepth is 16 with RGB565 color space but better immage quality can be obtained with 24 bits (i.e. using SDL_SetVideoMode(width, height, 24, flags)).
+
+
Power buttons are handled by SDL. Power switches off the Wii. Reset returns to Homebrew channel.
+
+
The library also inits the Wii video console.
=== SDL joystick mapping ===
=== SDL joystick mapping ===
+
+
The Wii controllers are mapped as SDL joysticks 0-3.
+
The gamecube controller ports are mapped as SDL joysticks 4-7.
+
The sticks and axes are mapped this way:
The sticks and axes are mapped this way:
Line 64:
Line 73:
|}
|}
−
Note: Axis 6,7 and 8 are the wiimote itself axis' orientation.
+
Axis 6,7 and 8 are the wiimote itself axis' orientation.
+
+
Triggers give only positive values (0-32678).
+
=== SDL joystick button mapping ===
=== SDL joystick button mapping ===
−
The D-pads on the Wii Remote and the Classic Controller are mapped as a [http://www.libsdl.org/cgi/docwiki.cgi/SDL_JoystickGetHat joystick hat]. Only one hat is reported per joystick, so when Classic Controller is plugged in, the D-pad on the Wii Remote is ignored. As far as orientation, SDL_HAT_UP is the up button on the Wii Remote's D-pad when it's held in horizontal position (with D-pad to the left).
+
The D-pads on the Wii Remote, the Classic Controller and Gamecube controller are mapped as a [http://www.libsdl.org/cgi/docwiki.cgi/SDL_JoystickGetHat joystick hat].
+
+
For Wii, only one hat is reported per joystick, so when Classic Controller is plugged in, the D-pad on the Wii Remote is ignored. As far as orientation, SDL_HAT_UP is the up button on the Wii Remote's D-pad when it's held in horizontal position (with D-pad to the left).
−
The wiimote buttons are mapped this way in SDL:
+
The wiimote and gamecube conntroller buttons are mapped this way in SDL:
{| class="wikitable"
{| class="wikitable"
Line 116:
Line 130:
|19 || || || {{WiimoteHomeButton}}
|19 || || || {{WiimoteHomeButton}}
|}
|}
+
+
+
=== SDL mouse mapping ===
+
+
Mouse movements are emulated by IR pointer of Wiimote 1 or/and a mouse connected in the USB port.
=== SDL mouse button mapping ===
=== SDL mouse button mapping ===
Line 127:
Line 146:
| Right button || {{WiimoteBButton}} || Right button
| Right button || {{WiimoteBButton}} || Right button
|}
|}
+
+
You have to point the Wiimote towards the screen to use the Wiimote buttons as mouse buttons.
== Bugs ==
== Bugs ==
* SDL_gfx eats up memory and can cause code dumps. If you get code dumps then try removing SDL_gfx.
* 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.
+
* See [http://code.google.com/p/sdl-wii/issues/list Issues] for bugs reporting.
== Source ==
== Source ==
Line 138:
Line 159:
== Tips ==
== Tips ==
−
* SDL_Init must include the SDL_INIT_JOYSTICK flag set for any input events to work, and SDL_JoystickOpen(0) must be called. Wiimote events come as SDL_MOUSBUTTON* and SDL_MOUSEMOTION as well as SDL_JOYBUTTON* events. To enable this, for all wiimote events (both joystick and mouse), you must set the joystick event processing state with SDL_JoystickEventState. If you are not handling the wiimote via the event queue then you must explicitly request a joystick update by calling SDL_JoystickUpdate.
+
* SDL_Init must include the SDL_INIT_JOYSTICK flag set for any input events to work, and SDL_JoystickOpen(0) must be called. When you point the Wiimote towards the screen, Wiimote events come as SDL_MOUSBUTTON and SDL_MOUSEMOTION as well as SDL_JOYBUTTON events. To enable this, for all wiimote events (both joystick and mouse), you must set the joystick event processing state with SDL_JoystickEventState. If you are not handling the wiimote via the event queue then you must explicitly request a joystick update by calling SDL_JoystickUpdate.
* If you're going to be doing file I/O operations, call fatInitDefault() before any calls to SDL. Lockups can occur if you call that after SDL and do some big writes to the SD card.
* If you're going to be doing file I/O operations, call fatInitDefault() before any calls to SDL. Lockups can occur if you call that after SDL and do some big writes to the SD card.
+
+
* The audio framebuffer lenght is fixed.
+
+
* No more then 12 user threads can be created.
== See Also ==
== See Also ==