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">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/WiiUseJavaC/wiiusej_WiiUseApi.def}""/>
|
||||
</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}""/>
|
||||
</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"/>
|
||||
</option>
|
||||
<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="additionalinput" paths="$(LIBS)"/>
|
||||
</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 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"/>
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#define WIIUSE_PATH "./wiiuse.so"
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define WIIUSE_PATH "wiiuse.dll"
|
||||
|
||||
#endif
|
||||
|
||||
#include "wiiusej_WiiUseApi.h"
|
||||
@@ -51,11 +50,13 @@ static int nbMaxWiiMotes=0;
|
||||
* Try to connect to 2 wiimotes.
|
||||
* Make them rumble to show they are connected.
|
||||
* @param nbConnects number of connections maximum.
|
||||
* @param rumble
|
||||
* make the connected wiimotes rumble.
|
||||
* @return 0 if there is an error otherwise it returns
|
||||
* the number of wiimotes connected..
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
||||
(JNIEnv *env, jobject obj, jint nbConnects) {
|
||||
(JNIEnv *env, jobject obj, jint nbConnects, jboolean rumble) {
|
||||
|
||||
/* variables declarations */
|
||||
int found, connected, i;
|
||||
@@ -99,17 +100,17 @@ JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
||||
else if (i%4==2) leds |= WIIMOTE_LED_3;
|
||||
else if (i%4==3) leds |= WIIMOTE_LED_4;
|
||||
wiiuse_set_leds(wiimotes[i], leds);
|
||||
wiiuse_rumble(wiimotes[i], 1);
|
||||
if (rumble) wiiuse_rumble(wiimotes[i], 1);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
usleep(200000);
|
||||
#else
|
||||
Sleep(200);
|
||||
#endif
|
||||
|
||||
for (i=0;i<nbMaxWiiMotes;i++) {
|
||||
wiiuse_rumble(wiimotes[i], 0);
|
||||
if (rumble) {
|
||||
#ifndef WIN32
|
||||
usleep(200000);
|
||||
#else
|
||||
Sleep(200);
|
||||
#endif
|
||||
for (i=0;i<nbMaxWiiMotes;i++) {
|
||||
wiiuse_rumble(wiimotes[i], 0);
|
||||
}
|
||||
}
|
||||
|
||||
//no pb connecting leave
|
||||
|
||||
@@ -10,10 +10,10 @@ extern "C" {
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: doConnections
|
||||
* Signature: (I)I
|
||||
* Signature: (IZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
|
||||
(JNIEnv *, jobject, jint);
|
||||
(JNIEnv *, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
|
||||
Reference in New Issue
Block a user