new version. with linux and you can choose wether you want to rumble wiimotes on connections.
git-svn-id: http://wiiusej.googlecode.com/svn/trunk@110 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
@@ -47,16 +47,17 @@
|
|||||||
<option id="gnu.c.link.option.userobjs.704698117" name="Other objects" superClass="gnu.c.link.option.userobjs" valueType="userObjs">
|
<option id="gnu.c.link.option.userobjs.704698117" name="Other objects" superClass="gnu.c.link.option.userobjs" valueType="userObjs">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/WiiUseJavaC/wiiusej_WiiUseApi.def}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/WiiUseJavaC/wiiusej_WiiUseApi.def}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.c.link.option.paths.1987293490" superClass="gnu.c.link.option.paths" valueType="libPaths">
|
<option id="gnu.c.link.option.paths.1987293490" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/WiiUseJavaC/lib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/WiiUseJavaC/lib}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.c.link.option.libs.2064083849" superClass="gnu.c.link.option.libs" valueType="libs">
|
<option id="gnu.c.link.option.libs.2064083849" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
|
||||||
<listOptionValue builtIn="false" value="wiiuse"/>
|
<listOptionValue builtIn="false" value="wiiuse"/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.86691693" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.86691693" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
</inputType>
|
</inputType>
|
||||||
|
<outputType id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.output.1574816302" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.output"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.863168128" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug">
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.863168128" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug">
|
||||||
<option defaultValue="true" id="gnu.cpp.link.mingw.so.debug.option.shared.503834207" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
<option defaultValue="true" id="gnu.cpp.link.mingw.so.debug.option.shared.503834207" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#define WIIUSE_PATH "./wiiuse.so"
|
|
||||||
#else
|
#else
|
||||||
#define WIIUSE_PATH "wiiuse.dll"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wiiusej_WiiUseApi.h"
|
#include "wiiusej_WiiUseApi.h"
|
||||||
@@ -51,11 +50,13 @@ static int nbMaxWiiMotes=0;
|
|||||||
* Try to connect to 2 wiimotes.
|
* Try to connect to 2 wiimotes.
|
||||||
* Make them rumble to show they are connected.
|
* Make them rumble to show they are connected.
|
||||||
* @param nbConnects number of connections maximum.
|
* @param nbConnects number of connections maximum.
|
||||||
|
* @param rumble
|
||||||
|
* make the connected wiimotes rumble.
|
||||||
* @return 0 if there is an error otherwise it returns
|
* @return 0 if there is an error otherwise it returns
|
||||||
* the number of wiimotes connected..
|
* the number of wiimotes connected..
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
||||||
(JNIEnv *env, jobject obj, jint nbConnects) {
|
(JNIEnv *env, jobject obj, jint nbConnects, jboolean rumble) {
|
||||||
|
|
||||||
/* variables declarations */
|
/* variables declarations */
|
||||||
int found, connected, i;
|
int found, connected, i;
|
||||||
@@ -99,18 +100,18 @@ JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
|||||||
else if (i%4==2) leds |= WIIMOTE_LED_3;
|
else if (i%4==2) leds |= WIIMOTE_LED_3;
|
||||||
else if (i%4==3) leds |= WIIMOTE_LED_4;
|
else if (i%4==3) leds |= WIIMOTE_LED_4;
|
||||||
wiiuse_set_leds(wiimotes[i], leds);
|
wiiuse_set_leds(wiimotes[i], leds);
|
||||||
wiiuse_rumble(wiimotes[i], 1);
|
if (rumble) wiiuse_rumble(wiimotes[i], 1);
|
||||||
}
|
}
|
||||||
|
if (rumble) {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
#else
|
#else
|
||||||
Sleep(200);
|
Sleep(200);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i=0;i<nbMaxWiiMotes;i++) {
|
for (i=0;i<nbMaxWiiMotes;i++) {
|
||||||
wiiuse_rumble(wiimotes[i], 0);
|
wiiuse_rumble(wiimotes[i], 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//no pb connecting leave
|
//no pb connecting leave
|
||||||
return connected;
|
return connected;
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Class: wiiusej_WiiUseApi
|
* Class: wiiusej_WiiUseApi
|
||||||
* Method: doConnections
|
* Method: doConnections
|
||||||
* Signature: (I)I
|
* Signature: (IZ)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
||||||
(JNIEnv *, jobject, jint);
|
(JNIEnv *, jobject, jint, jboolean);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: wiiusej_WiiUseApi
|
* Class: wiiusej_WiiUseApi
|
||||||
|
|||||||
Reference in New Issue
Block a user