|
wavelength 1.0.0
|
#include "app/msgsink.h"

Go to the source code of this file.
Classes | |
| struct | JoypadStick |
| Position of one analogue stick. More... | |
| class | JoypadState |
| State of one controller port as the last poll read it. More... | |
Enumerations | |
| enum | JoypadButton { kPadL2 = 0 , kPadR2 = 1 , kPadL1 = 2 , kPadR1 = 3 , kPadTriangle = 4 , kPadCircle = 5 , kPadCross = 6 , kPadSquare = 7 , kPadSelect = 8 , kPadL3 = 9 , kPadR3 = 10 , kPadStart = 11 , kPadDUp = 12 , kPadDRight = 13 , kPadDDown = 14 , kPadDLeft = 15 , kPadLeftStickUp = 16 , kPadLeftStickRight = 17 , kPadLeftStickDown = 18 , kPadLeftStickLeft = 19 , kPadRightStickUp = 20 , kPadRightStickRight = 21 , kPadRightStickDown = 22 , kPadRightStickLeft = 23 , kPadNone = 24 } |
| Buttons of a controller, the values JoypadInputMsg::mButton takes. More... | |
Functions | |
| void | JoypadInit () |
| Open every controller port and give the first port to pad 0. | |
| void | JoypadTerminate () |
| Shut the controller layer down. | |
| void | JoypadPoll () |
| Read every controller port that serves a pad, and send messages for what changed. | |
| int | JoypadWait () |
| Wait for pad 0 to release every button and then press one. | |
| JoypadState * | JoypadGetState (int nPad) |
| Report the state of a controller. | |
| void | JoypadAddSink (MsgSink *pSink) |
| Add a sink to the receivers of the controller messages. | |
| void | JoypadRemoveSink (MsgSink *pSink) |
| Remove a sink from the receivers of the controller messages. | |
| void | JoypadSetStickMessages (bool bEnable) |
| Turn the analog stick messages of the controller poll on or off. | |
| void | JoypadSetMenuControl (int nPad, bool bMenu) |
| Give the input of a controller to the menus or to the running world. | |
| void | JoypadSetVibration (int nPad, int nSmallMotor, int nBigMotor) |
| Drive the vibration motors of the controller on a port. | |
| void | JoypadMapDefault (bool bPort0Multitap, bool bPort1Multitap) |
| Give the controller ports to the pads. | |
| int | JoypadMultitapConnected () |
| Report whether a multitap is connected, as the controller poll last found. | |
Variables | |
| constexpr int | kJoypadNumSticks = 2 |
| The number of analogue sticks of a controller. | |
| constexpr int | kJoypadNumButtons = 24 |
| The number of buttons of a controller, counting the stick directions. | |
| constexpr int | kJoypadNumPorts = 8 |
| The number of controllers the poll reads, four multitap slots on each of two ports. | |
| constexpr int | kJoypadNumPads = 4 |
| The number of players the controllers can be given to. | |
| constexpr int | kJoypadNoPad = -1 |
| The pad a port stores while no player uses it. | |
| enum JoypadButton |
Buttons of a controller, the values JoypadInputMsg::mButton takes.
The name is inferred.
| void JoypadInit | ( | ) |
Open every controller port and give the first port to pad 0.
Reads the deadzone and threshold settings of the joypad block of the system configuration, 24 and 0.75 by default.
| void JoypadTerminate | ( | ) |
Shut the controller layer down.
The body does nothing.
| void JoypadPoll | ( | ) |
Read every controller port that serves a pad, and send messages for what changed.
Sends a JoypadConnectionMsg when a pad connects or disconnects, a JoypadAnalogStickMsg when a stick moves while JoypadSetStickMessages() is on, and a JoypadInputMsg for each button pressed or released. A digital-only pad is ignored. Before JoypadInit() the call only reports an error.
| int JoypadWait | ( | ) |
Wait for pad 0 to release every button and then press one.
Before JoypadInit() the call waits five seconds instead.
| JoypadState * JoypadGetState | ( | int | nPad | ) |
Report the state of a controller.
| nPad | The controller. |
| void JoypadAddSink | ( | MsgSink * | pSink | ) |
Add a sink to the receivers of the controller messages.
| pSink | The sink. |
| void JoypadRemoveSink | ( | MsgSink * | pSink | ) |
Remove a sink from the receivers of the controller messages.
| pSink | The sink. |
| void JoypadSetStickMessages | ( | bool | bEnable | ) |
Turn the analog stick messages of the controller poll on or off.
While the setting is off, the poll does not compare stick positions and sends no message for a moved stick. The setting starts off. The name is inferred from the behaviour.
| bEnable | Whether moved sticks send messages. |
| void JoypadSetMenuControl | ( | int | nPad, |
| bool | bMenu ) |
Give the input of a controller to the menus or to the running world.
WorldLogic gives every controller to the world while it exists, and a paused game gives them back to the menus. While the menus receive a pad's input, its left stick also presses the directional buttons. The name is inferred.
| nPad | The controller. |
| bMenu | Whether the menus receive the input. |
| void JoypadSetVibration | ( | int | nPad, |
| int | nSmallMotor, | ||
| int | nBigMotor ) |
Drive the vibration motors of the controller on a port.
The name is inferred.
| nPad | The controller port. |
| nSmallMotor | The small motor's state, 0 or 1. |
| nBigMotor | The big motor's level. |
| void JoypadMapDefault | ( | bool | bPort0Multitap, |
| bool | bPort1Multitap ) |
Give the controller ports to the pads.
With bPort0Multitap set, the four slots of port 0 serve pads 0 to 3. Otherwise slot 0 of port 0 serves pad 0, slot 0 of port 1 serves pad 1 unless bPort1Multitap is set, and the other slots serve no pad.
| bPort0Multitap | Whether a multitap is connected to port 0. |
| bPort1Multitap | Whether a multitap is connected to port 1. |
| int JoypadMultitapConnected | ( | ) |
Report whether a multitap is connected, as the controller poll last found.
The name is inferred from the player count screen. That screen offers three and four players only while the flag is set.
|
constexpr |
The number of analogue sticks of a controller.
|
constexpr |
The number of buttons of a controller, counting the stick directions.
|
constexpr |
The number of controllers the poll reads, four multitap slots on each of two ports.
|
constexpr |
The number of players the controllers can be given to.
|
constexpr |
The pad a port stores while no player uses it.