new version for linux and now you can choose if you want to make the wiimotes rumble on connections.

git-svn-id: http://wiiusej.googlecode.com/svn/trunk@111 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
guilhem.duche
2008-03-30 17:57:28 +00:00
parent 3223e90f40
commit 49135d88f7
5 changed files with 171 additions and 112 deletions

View File

@@ -64,12 +64,14 @@ public class WiiUseApiManager extends Thread {
*
* @param nb
* try to connect nb wiimotes
* @param rumble
* make the connected wiimotes rumble
* @return an array with connected wiimotes or NULL.
*/
public synchronized static Wiimote[] getWiimotes(int nb) {
public synchronized static Wiimote[] getWiimotes(int nb, boolean rumble) {
WiiUseApiManager manager = getInstance();
if (manager.connected < 0) {
int nbWiimotes = manager.connectWiimotes(nb);
int nbWiimotes = manager.connectWiimotes(nb, rumble);
manager.wiimotes = new Wiimote[nbWiimotes];
for (int i = 1; i <= nbWiimotes; i++) {
Wiimote wim = new Wiimote(i, manager);
@@ -94,12 +96,14 @@ public class WiiUseApiManager extends Thread {
*
* @param nb
* try to connect nb wiimotes
* @param rumble
* make the connected wiimotes rumble
* @return 0 if nothing connected or the number of wiimotes connected.
*/
private int connectWiimotes(int nb) {
private int connectWiimotes(int nb, boolean rumble) {
nbMaxWiimotes = nb;
if (connected < 0) {
connected = wiiuse.doConnections(nb);
connected = wiiuse.doConnections(nb, rumble);
return connected;
} else {// library not loaded, no wiimotes connected
return 0;