Ongebruikte bestanden met onbeschikbare afhankelijkheden in Mimis verwijderd. JNI compile configuraties aangepast en Wiiuse foutje weggewerkt.
This commit is contained in:
2356
cpp/mimis/.cproject
2356
cpp/mimis/.cproject
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||||
<value>${workspace_loc:/Mimis JNI/Release}</value>
|
<value>${workspace_loc:/Mimis JNI/Debug}</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.contents</key>
|
<key>org.eclipse.cdt.make.core.contents</key>
|
||||||
|
|||||||
66
cpp/mimis/.settings/org.eclipse.cdt.codan.core.prefs
Normal file
66
cpp/mimis/.settings/org.eclipse.cdt.codan.core.prefs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#Wed Sep 28 10:46:29 CEST 2011
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
|
||||||
|
org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false}
|
||||||
|
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
|
||||||
|
org.eclipse.cdt.codan.checkers.errreturnvalue.params={}
|
||||||
|
org.eclipse.cdt.codan.checkers.noreturn=Error
|
||||||
|
org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={exceptions\=>("@(\#)","$Id")}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "mimis.h"
|
#include "mimis.h"
|
||||||
|
#include <windows.h>
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
|
|
||||||
bool getProcessEntry32(const char *program, PROCESSENTRY32 *pe32) {
|
bool getProcessEntry32(const char *program, PROCESSENTRY32 *pe32) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef MIMIS_H_
|
#ifndef MIMIS_H_
|
||||||
#define MIMIS_H_
|
#define MIMIS_H_
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
1523
cpp/wiiuse/.cproject
1523
cpp/wiiuse/.cproject
File diff suppressed because it is too large
Load Diff
@@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348">
|
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
<macros>
|
<macros>
|
||||||
<stringMacro name="target" type="VALUE_TEXT" value="wiiusej"/>
|
<stringMacro name="target" type="VALUE_TEXT" value="wiiusej"/>
|
||||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.6.0_26"/>
|
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||||
</macros>
|
</macros>
|
||||||
<externalSettings>
|
<externalSettings>
|
||||||
<externalSetting>
|
<externalSetting>
|
||||||
@@ -24,308 +24,61 @@
|
|||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.exe.debug" postbuildStep="./copy.bat">
|
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.so.debug" postbuildStep="./copy.bat">
|
||||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616." name="/" resourcePath="">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.895681267" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug">
|
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.debug.1191523047" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.debug">
|
||||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.1030487368" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/>
|
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.debug.306321031" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.debug"/>
|
||||||
<builder buildPath="${workspace_loc:/WiiuseJ/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1021644937" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
<builder buildPath="${workspace_loc:/WiiuseJ/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.531289265" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.695758821" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug">
|
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug.781950854" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug">
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.29542838" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.676801089" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.archiver.mingw.base.298855503" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1717798063" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1697547310" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug.721099204" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug">
|
||||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.832767743" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.so.debug.option.optimization.level.1512062314" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1726909273" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.so.debug.option.debugging.level.1185068058" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||||
</tool>
|
<option id="gnu.cpp.compiler.option.include.paths.716839450" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.739602421" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
|
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.880507952" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" valueType="enumerated"/>
|
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||||
<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.155746765" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
|
||||||
<option id="gnu.c.compiler.option.include.paths.272434551" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
|
||||||
<listOptionValue builtIn="false" value=""${jdk}\include""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${jdk}\include\win32""/>
|
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.294134268" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.842669563" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1924732865" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug">
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.1784371330" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug">
|
||||||
<option id="gnu.c.link.option.libs.917834369" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
|
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.so.debug.option.optimization.level.2033163253" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.debug.option.optimization.level" valueType="enumerated"/>
|
||||||
<listOptionValue builtIn="false" value="wiiuse"/>
|
<option id="gnu.c.compiler.mingw.so.debug.option.debugging.level.478300262" name="Debug Level" superClass="gnu.c.compiler.mingw.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.option.include.paths.486668115" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.c.link.option.paths.1324576146" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.820612620" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.424942675" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug">
|
||||||
|
<option defaultValue="true" id="gnu.c.link.mingw.so.debug.option.shared.450186350" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.748142627" 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.507004830" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.debug.option.shared" valueType="boolean"/>
|
||||||
|
<option id="gnu.cpp.link.option.paths.45705116" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
|
||||||
</option>
|
</option>
|
||||||
<option defaultValue="true" id="gnu.c.link.option.shared.421582487" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
|
<option id="gnu.cpp.link.option.libs.102697521" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||||
<option id="gnu.c.link.option.ldflags.969988762" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-Wl,--kill-at" valueType="string"/>
|
<listOptionValue builtIn="false" value="wiiuse"/>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.896502267" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
</option>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1307869739" superClass="cdt.managedbuild.tool.gnu.cpp.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.output.base.253590092" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.output.base"/>
|
<outputType id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.output.1609835672" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.output"/>
|
||||||
</tool>
|
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.786697019" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug">
|
|
||||||
<option defaultValue="true" id="gnu.cpp.link.option.shared.811098912" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" valueType="boolean"/>
|
|
||||||
</tool>
|
</tool>
|
||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="scannerConfiguration">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.905874158;cdt.managedbuild.config.gnu.mingw.exe.release.905874158.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.860789151;cdt.managedbuild.tool.gnu.c.compiler.input.1381420606">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348;cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.739602421;cdt.managedbuild.tool.gnu.c.compiler.input.294134268">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.905874158">
|
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.release.872708280">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.905874158" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.release.872708280" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
<macros>
|
<macros>
|
||||||
<stringMacro name="target" type="VALUE_TEXT" value="wiiusej"/>
|
<stringMacro name="target" type="VALUE_TEXT" value="wiiusej"/>
|
||||||
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.6.0_26"/>
|
<stringMacro name="jdk" type="VALUE_PATH_DIR" value="C:\Program Files (x86)\Java\jdk1.7.0"/>
|
||||||
</macros>
|
</macros>
|
||||||
<externalSettings>
|
<externalSettings>
|
||||||
<externalSetting>
|
<externalSetting>
|
||||||
@@ -342,306 +95,72 @@
|
|||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.release.905874158" name="Release" parent="cdt.managedbuild.config.gnu.mingw.exe.release" postbuildStep="./copy.bat">
|
<configuration artifactExtension="dll" artifactName="${target}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.release.872708280" name="Release" parent="cdt.managedbuild.config.gnu.mingw.so.release" postbuildStep="./copy.bat">
|
||||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.905874158." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.release.872708280." name="/" resourcePath="">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.release.1641725860" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.release">
|
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.release.582624041" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.release">
|
||||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.release.209964646" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.release"/>
|
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.release.852849225" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.release"/>
|
||||||
<builder buildPath="${workspace_loc:/WiiuseJ/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1531172407" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
<builder buildPath="${workspace_loc:/WiiuseJ/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1667515887" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release.789581442" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release">
|
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.so.release.1955417593" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.release">
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1194500313" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.204782274" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.archiver.mingw.base.500323157" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.2134712739" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.8324814" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release">
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release.1470980799" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release">
|
||||||
<option id="gnu.cpp.compiler.mingw.exe.release.option.optimization.level.350583195" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.so.release.option.optimization.level.1203189311" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||||
<option id="gnu.cpp.compiler.mingw.exe.release.option.debugging.level.301268183" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.mingw.so.release.option.debugging.level.1388109930" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||||
</tool>
|
<option id="gnu.cpp.compiler.option.include.paths.1188267253" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.860789151" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
|
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.1390835827" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" valueType="enumerated"/>
|
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||||
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.1039547656" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
|
||||||
<option id="gnu.c.compiler.option.include.paths.360189205" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
|
||||||
<listOptionValue builtIn="false" value=""${jdk}\include""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${jdk}\include\win32""/>
|
|
||||||
</option>
|
</option>
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1381420606" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1449486447" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.1153954081" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release">
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.1707196863" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release">
|
||||||
<option defaultValue="true" id="gnu.c.link.option.shared.761386503" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
|
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.so.release.option.optimization.level.899996696" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.release.option.optimization.level" valueType="enumerated"/>
|
||||||
<option id="gnu.c.link.option.paths.687535688" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
|
<option id="gnu.c.compiler.mingw.so.release.option.debugging.level.1336215997" name="Debug Level" superClass="gnu.c.compiler.mingw.so.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.option.include.paths.13176781" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${jdk}/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.839631863" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release.901924366" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release">
|
||||||
|
<option defaultValue="true" id="gnu.c.link.mingw.so.release.option.shared.1261255803" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.release.option.shared" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.649216061" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release">
|
||||||
|
<option defaultValue="true" id="gnu.cpp.link.mingw.so.release.option.shared.401829660" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.release.option.shared" valueType="boolean"/>
|
||||||
|
<option id="gnu.cpp.link.option.paths.1462133636" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.c.link.option.libs.42070036" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
|
<option id="gnu.cpp.link.option.libs.173366246" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||||
<listOptionValue builtIn="false" value="wiiuse"/>
|
<listOptionValue builtIn="false" value="wiiuse"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="gnu.c.link.option.ldflags.1604848740" name="Linker flags" superClass="gnu.c.link.option.ldflags" value="-Wl,--kill-at" valueType="string"/>
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.790138545" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||||
<option id="gnu.c.link.option.soname.2103161002" name="Shared object name (-Wl,-soname=)" superClass="gnu.c.link.option.soname" value="" valueType="string"/>
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.657886763" 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.output.base.1635057247" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.output.base"/>
|
|
||||||
</tool>
|
|
||||||
<tool command="gcc" id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release.1531205530" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release">
|
|
||||||
<option defaultValue="true" id="gnu.cpp.link.option.shared.1255522348" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" valueType="boolean"/>
|
|
||||||
</tool>
|
</tool>
|
||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="scannerConfiguration">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.905874158;cdt.managedbuild.config.gnu.mingw.exe.release.905874158.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.860789151;cdt.managedbuild.tool.gnu.c.compiler.input.1381420606">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348;cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.739602421;cdt.managedbuild.tool.gnu.c.compiler.input.294134268">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="makefileGenerator">
|
|
||||||
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
|
||||||
<buildOutputProvider>
|
|
||||||
<openAction enabled="true" filePath=""/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</buildOutputProvider>
|
|
||||||
<scannerInfoProvider id="specsFile">
|
|
||||||
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
|
||||||
<parser enabled="true"/>
|
|
||||||
</scannerInfoProvider>
|
|
||||||
</profile>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<project id="WiiuseJ.cdt.managedbuild.target.gnu.mingw.exe.120910549" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/>
|
<project id="WiiuseJ.cdt.managedbuild.target.gnu.mingw.so.885833889" name="Shared Library" projectType="cdt.managedbuild.target.gnu.mingw.so"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616;cdt.managedbuild.config.gnu.mingw.so.debug.1025362616.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.1784371330;cdt.managedbuild.tool.gnu.c.compiler.input.820612620">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.872708280;cdt.managedbuild.config.gnu.mingw.so.release.872708280.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release.1470980799;cdt.managedbuild.tool.gnu.cpp.compiler.input.1449486447">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1025362616;cdt.managedbuild.config.gnu.mingw.so.debug.1025362616.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug.721099204;cdt.managedbuild.tool.gnu.cpp.compiler.input.842669563">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.872708280;cdt.managedbuild.config.gnu.mingw.so.release.872708280.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.1707196863;cdt.managedbuild.tool.gnu.c.compiler.input.839631863">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
</cproject>
|
</cproject>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||||
<value>${workspace_loc:/WiiuseJ/Release}</value>
|
<value>${workspace_loc:/WiiuseJ/Debug}</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.contents</key>
|
<key>org.eclipse.cdt.make.core.contents</key>
|
||||||
@@ -66,5 +66,6 @@
|
|||||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#Wed Jul 20 00:04:50 CEST 2011
|
#Wed Sep 28 12:08:21 CEST 2011
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/CPATH/delimiter=;
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/CPATH/delimiter=;
|
||||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/CPATH/operation=remove
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/CPATH/operation=remove
|
||||||
@@ -12,6 +12,22 @@ environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.releas
|
|||||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/C_INCLUDE_PATH/operation=remove
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/C_INCLUDE_PATH/operation=remove
|
||||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/append=true
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/append=true
|
||||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/appendContributed=true
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/appendContributed=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/CPATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/CPATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/CPLUS_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/CPLUS_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/C_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/C_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/append=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/appendContributed=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/CPATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/CPATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/CPLUS_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/CPLUS_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/C_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/C_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/append=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.872708280/appendContributed=true
|
||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/LIBRARY_PATH/delimiter=;
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/LIBRARY_PATH/delimiter=;
|
||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/LIBRARY_PATH/operation=remove
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/LIBRARY_PATH/operation=remove
|
||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/append=true
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1519811348/append=true
|
||||||
@@ -20,3 +36,11 @@ environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.releas
|
|||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/LIBRARY_PATH/operation=remove
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/LIBRARY_PATH/operation=remove
|
||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/append=true
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/append=true
|
||||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/appendContributed=true
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.905874158/appendContributed=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/LIBRARY_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/LIBRARY_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/append=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.debug.1025362616/appendContributed=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.release.872708280/LIBRARY_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.release.872708280/LIBRARY_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.release.872708280/append=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.so.release.872708280/appendContributed=true
|
||||||
|
|||||||
Binary file not shown.
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "wiiusej_WiiUseApi.h"
|
#include "wiiusej_WiiUseApi.h"
|
||||||
#include "wiiuse.h"
|
#include "wiiuse.h"
|
||||||
|
#include <jni.h>
|
||||||
/*
|
/*
|
||||||
* These are some identifiers for wiimotes
|
* These are some identifiers for wiimotes
|
||||||
*
|
*
|
||||||
|
|||||||
BIN
java/mimis.dll
BIN
java/mimis.dll
Binary file not shown.
@@ -76,7 +76,6 @@ public final class JIntellitype implements JIntellitypeConstants {
|
|||||||
/**
|
/**
|
||||||
* Handler is used by JNI code to keep different JVM instances separate
|
* Handler is used by JNI code to keep different JVM instances separate
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private final int handler = 0;
|
private final int handler = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,9 +31,10 @@ package com.melloware.jintellitype;
|
|||||||
* @version 1.3.1
|
* @version 1.3.1
|
||||||
*/
|
*/
|
||||||
public class JIntellitypeException extends RuntimeException {
|
public class JIntellitypeException extends RuntimeException {
|
||||||
|
protected static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
public JIntellitypeException() {
|
public JIntellitypeException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.util.Properties;
|
|||||||
* @author Emil A. Lefkof III <info@melloware.com>
|
* @author Emil A. Lefkof III <info@melloware.com>
|
||||||
* @version 1.3.1
|
* @version 1.3.1
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("")
|
|
||||||
public final class Main {
|
public final class Main {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public abstract class Worker implements Runnable {
|
|||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.debug("note");
|
|
||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package mimis.event.feedback;
|
|||||||
import mimis.event.Feedback;
|
import mimis.event.Feedback;
|
||||||
|
|
||||||
public class TextFeedback extends Feedback {
|
public class TextFeedback extends Feedback {
|
||||||
|
protected static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected String text;
|
protected String text;
|
||||||
|
|
||||||
public TextFeedback(String text) {
|
public TextFeedback(String text) {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
TODO
|
TODO
|
||||||
------------
|
------------
|
||||||
exeptions en foutmeldingen nakijken/afhandelen/loggen
|
exceptions en foutmeldingen nakijken/afhandelen/loggen
|
||||||
|
|
||||||
feedback?
|
feedback uitbreiden
|
||||||
|
|
||||||
mogelijkheid tot webstart onderzoeken
|
mogelijkheid tot webstart onderzoeken
|
||||||
|
|
||||||
exporteren naar uitvoerbare jar file
|
|
||||||
@@ -1,17 +1,58 @@
|
|||||||
package mimis.worker;
|
package mimis.worker;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import mimis.Worker;
|
import mimis.Worker;
|
||||||
|
import mimis.exception.worker.ActivateException;
|
||||||
|
import mimis.exception.worker.DeactivateException;
|
||||||
|
|
||||||
public class Periodic extends Worker {
|
public class Periodic extends Worker {
|
||||||
|
public static final int PERIOD = 500;
|
||||||
|
|
||||||
|
protected TimerTask timerTask;
|
||||||
|
protected Timer timer;
|
||||||
|
protected int period;
|
||||||
|
|
||||||
public Periodic() {
|
public Periodic() {
|
||||||
|
this(PERIOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Periodic(int period) {
|
||||||
|
this.period = period;
|
||||||
|
timerTask = new TimerTask() {
|
||||||
|
public void run() {
|
||||||
|
if (deactivate) {
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
work();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer = new Timer();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void activate() throws ActivateException {
|
||||||
|
timer.scheduleAtFixedRate(timerTask, 0, period);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void deactivate() throws DeactivateException {
|
||||||
|
//timer.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void work() {
|
protected void work() {
|
||||||
|
log.debug("work!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
|
Periodic periodic = new Periodic();
|
||||||
|
periodic.start();
|
||||||
|
sleep(1000);
|
||||||
|
periodic.stop();
|
||||||
|
sleep(1000);
|
||||||
|
periodic.start();
|
||||||
|
sleep(10000);
|
||||||
|
System.exit(1);
|
||||||
Worker worker = new Worker() {
|
Worker worker = new Worker() {
|
||||||
protected void work() {
|
protected void work() {
|
||||||
log.debug("work()");
|
log.debug("work()");
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* wiigee - accelerometerbased gesture recognition
|
|
||||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
|
||||||
*
|
|
||||||
* Developed at University of Oldenburg
|
|
||||||
* Contact: wiigee@benjaminpoppinga.de
|
|
||||||
*
|
|
||||||
* This file is part of wiigee.
|
|
||||||
*
|
|
||||||
* wiigee is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
package org.wiigee.control;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import org.wiigee.device.Wiimote;
|
|
||||||
import org.wiigee.util.Log;
|
|
||||||
|
|
||||||
public class WiimoteDeviceDiscovery implements DiscoveryListener {
|
|
||||||
|
|
||||||
private Vector<RemoteDevice> devices;
|
|
||||||
private boolean isInquiring;
|
|
||||||
private final Object lock;
|
|
||||||
|
|
||||||
public WiimoteDeviceDiscovery(Object lock) {
|
|
||||||
super();
|
|
||||||
this.lock = lock;
|
|
||||||
this.devices = new Vector<RemoteDevice>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deviceDiscovered(RemoteDevice newdevice, DeviceClass devclass) {
|
|
||||||
Log.write("Device discovered: " + newdevice.getBluetoothAddress() + " - ");
|
|
||||||
// add the device to the vector
|
|
||||||
if (!devices.contains(newdevice) &&
|
|
||||||
devclass.getMajorDeviceClass() == 1280 &&
|
|
||||||
devclass.getMinorDeviceClass() == 4) {
|
|
||||||
Log.write("Is a Wiimote!");
|
|
||||||
devices.addElement(newdevice);
|
|
||||||
} else {
|
|
||||||
Log.write("Is NOT a Wiimote OR you're using an incompatible Bluetooth Stack.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inquiryCompleted(int discType) {
|
|
||||||
switch (discType) {
|
|
||||||
case WiimoteDeviceDiscovery.INQUIRY_COMPLETED:
|
|
||||||
Log.write("Inquiry completed.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WiimoteDeviceDiscovery.INQUIRY_ERROR:
|
|
||||||
Log.write("Inquiry error.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WiimoteDeviceDiscovery.INQUIRY_TERMINATED:
|
|
||||||
Log.write("Inquiry terminated.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
synchronized (this.lock) {
|
|
||||||
this.lock.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serviceSearchCompleted(int arg0, int arg1) {
|
|
||||||
// not necessary
|
|
||||||
}
|
|
||||||
|
|
||||||
public void servicesDiscovered(int arg0, ServiceRecord[] arg1) {
|
|
||||||
// not necessary
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInquirying() {
|
|
||||||
return this.isInquiring;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector<Wiimote> getDiscoveredWiimotes() throws IOException {
|
|
||||||
Vector<Wiimote> wiimotes = new Vector<Wiimote>();
|
|
||||||
|
|
||||||
for (int i = 0; i < devices.size(); i++) {
|
|
||||||
wiimotes.add(new Wiimote(devices.elementAt(i).getBluetoothAddress(), true, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
return wiimotes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
* wiigee - accelerometerbased gesture recognition
|
|
||||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
|
||||||
*
|
|
||||||
* Developed at University of Oldenburg
|
|
||||||
* Contact: wiigee@benjaminpoppinga.de
|
|
||||||
*
|
|
||||||
* This file is part of wiigee.
|
|
||||||
*
|
|
||||||
* wiigee is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
package org.wiigee.control;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import org.wiigee.device.Wiimote;
|
|
||||||
import org.wiigee.event.AccelerationListener;
|
|
||||||
import org.wiigee.event.GestureListener;
|
|
||||||
import org.wiigee.filter.Filter;
|
|
||||||
import org.wiigee.util.Log;
|
|
||||||
|
|
||||||
// Singleton
|
|
||||||
public class WiimoteWiigee extends Wiigee {
|
|
||||||
|
|
||||||
protected static String pluginversion = "1.5.6";
|
|
||||||
protected static String pluginreleasedate = "20090817";
|
|
||||||
private static final Object lock = new Object();
|
|
||||||
private Vector<Wiimote> devices;
|
|
||||||
|
|
||||||
public WiimoteWiigee() {
|
|
||||||
super();
|
|
||||||
String stack;
|
|
||||||
String stackVersion;
|
|
||||||
String l2capFeature;
|
|
||||||
String bluecoveVersion;
|
|
||||||
|
|
||||||
Log.write("This is wiigee-plugin-wiimote version " + pluginversion + " (" + pluginreleasedate + ")");
|
|
||||||
|
|
||||||
// Bluecove
|
|
||||||
bluecoveVersion = LocalDevice.getProperty("bluecove");
|
|
||||||
if(!bluecoveVersion.equals("")) {
|
|
||||||
|
|
||||||
stack = LocalDevice.getProperty("bluecove.stack");
|
|
||||||
stackVersion = LocalDevice.getProperty("bluecove.stack.version");
|
|
||||||
Log.write("You are using the "+stack+" Bluetooth stack (Version "+stackVersion+")");
|
|
||||||
|
|
||||||
l2capFeature = LocalDevice.getProperty("bluecove.feature.l2cap");
|
|
||||||
Log.write("L2CAP supported: "+l2capFeature);
|
|
||||||
|
|
||||||
if(l2capFeature.equals("true")) {
|
|
||||||
Log.write("wiigee: found a supported stack!");
|
|
||||||
|
|
||||||
// set min id for Bluecove
|
|
||||||
Log.write(Log.DEBUG, "JSR82 PSM Minimum Restriction -- OFF", null);
|
|
||||||
System.setProperty("bluecove.jsr82.psm_minimum_off", "true");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.write("No Bluecove Library detected - trying anyway...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Automatically discovers Wiimotes nearby and connects to
|
|
||||||
* the first responding Wiimote visible. For multiple managed
|
|
||||||
* instances of the Wiimote, please use getDevices().
|
|
||||||
*
|
|
||||||
* @return First visible Wiimote. Null otherwise.
|
|
||||||
* @throws java.io.IOException
|
|
||||||
*/
|
|
||||||
public Wiimote getDevice() throws IOException {
|
|
||||||
this.devices = this.discoverWiimotes();
|
|
||||||
if(this.devices.size()>0) {
|
|
||||||
return devices.elementAt(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of all discovered Wiimotes. The count
|
|
||||||
* of Devices depends on your computers bluetooth capabilities.
|
|
||||||
* Usually up to 7 Wiimotes/Devices can be connected.
|
|
||||||
*
|
|
||||||
* @return Array of discovered wiimotes or null if
|
|
||||||
* none discoverd.
|
|
||||||
*/
|
|
||||||
public Wiimote[] getDevices() throws IOException {
|
|
||||||
this.devices = this.discoverWiimotes();
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).setLED(i + 1);
|
|
||||||
}
|
|
||||||
Wiimote[] out = new Wiimote[this.devices.size()];
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
out[i] = this.devices.elementAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(out.length>0) {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Discover the wiimotes around the bluetooth host and
|
|
||||||
* make them available public via getWiimotes method.
|
|
||||||
*
|
|
||||||
* @return Array of discovered wiimotes.
|
|
||||||
*/
|
|
||||||
private Vector<Wiimote> discoverWiimotes() throws IOException {
|
|
||||||
WiimoteDeviceDiscovery deviceDiscovery = new WiimoteDeviceDiscovery(lock);
|
|
||||||
LocalDevice localDevice = LocalDevice.getLocalDevice();
|
|
||||||
Log.write("Your Computers Bluetooth MAC: " + localDevice.getBluetoothAddress());
|
|
||||||
|
|
||||||
Log.write("Starting device inquiry...");
|
|
||||||
DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
|
|
||||||
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, deviceDiscovery);
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
synchronized (lock) {
|
|
||||||
lock.wait();
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Log.write("Problems during device discovery.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.write("Device discovery completed!");
|
|
||||||
return deviceDiscovery.getDiscoveredWiimotes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of wiimotes discovered.
|
|
||||||
*
|
|
||||||
* @return Number of wiimotes discovered.
|
|
||||||
*/
|
|
||||||
public int getNumberOfDevices() {
|
|
||||||
if(this.devices!=null) {
|
|
||||||
return this.devices.size();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the Trainbutton for all wiimotes;
|
|
||||||
*
|
|
||||||
* @param b ManageButton encoding, see static Wiimote values
|
|
||||||
*/
|
|
||||||
public void setTrainButton(int b) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).setTrainButton(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the Recognitionbutton for all wiimotes;
|
|
||||||
*
|
|
||||||
* @param b ManageButton encoding, see static Wiimote values
|
|
||||||
*/
|
|
||||||
public void setRecognitionButton(int b) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).setRecognitionButton(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the CloseGesturebutton for all wiimotes;
|
|
||||||
*
|
|
||||||
* @param b ManageButton encoding, see static Wiimote values
|
|
||||||
*/
|
|
||||||
public void setCloseGestureButton(int b) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).setCloseGestureButton(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDeviceListener(AccelerationListener listener) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).addAccelerationListener(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addGestureListener(GestureListener listener) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).addGestureListener(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAccelerationFilter(Filter filter) {
|
|
||||||
for (int i = 0; i < this.devices.size(); i++) {
|
|
||||||
this.devices.elementAt(i).addAccelerationFilter(filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,605 +0,0 @@
|
|||||||
/*
|
|
||||||
* wiigee - accelerometerbased gesture recognition
|
|
||||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
|
||||||
*
|
|
||||||
* Developed at University of Oldenburg
|
|
||||||
* Contact: wiigee@benjaminpoppinga.de
|
|
||||||
*
|
|
||||||
* This file is part of wiigee.
|
|
||||||
*
|
|
||||||
* wiigee is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
package org.wiigee.device;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import org.wiigee.event.InfraredEvent;
|
|
||||||
import org.wiigee.event.InfraredListener;
|
|
||||||
import org.wiigee.event.RotationEvent;
|
|
||||||
import org.wiigee.event.RotationListener;
|
|
||||||
import org.wiigee.event.RotationSpeedEvent;
|
|
||||||
import org.wiigee.filter.Filter;
|
|
||||||
import org.wiigee.util.Log;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents the basic functions of the wiimote.
|
|
||||||
* If you want your wiimote to e.g. vibrate you'll do this here.
|
|
||||||
*
|
|
||||||
* @author Benjamin 'BePo' Poppinga
|
|
||||||
*/
|
|
||||||
public class Wiimote extends Device {
|
|
||||||
|
|
||||||
// Fixed number values.
|
|
||||||
public static final int BUTTON_2 = 0x0001;
|
|
||||||
public static final int BUTTON_1 = 0x0002;
|
|
||||||
public static final int BUTTON_B = 0x0004;
|
|
||||||
public static final int BUTTON_A = 0x0008;
|
|
||||||
public static final int BUTTON_MINUS = 0x0010;
|
|
||||||
public static final int BUTTON_HOME = 0x0080;
|
|
||||||
public static final int BUTTON_LEFT = 0x0100;
|
|
||||||
public static final int BUTTON_RIGHT = 0x0200;
|
|
||||||
public static final int BUTTON_DOWN = 0x0400;
|
|
||||||
public static final int BUTTON_UP = 0x0800;
|
|
||||||
public static final int BUTTON_PLUS = 0x1000;
|
|
||||||
|
|
||||||
// Reports
|
|
||||||
public static final byte CMD_SET_REPORT = 0x52;
|
|
||||||
|
|
||||||
// IR Modes
|
|
||||||
public static final byte IR_MODE_STANDARD = 0x01;
|
|
||||||
public static final byte IR_MODE_EXTENDED = 0x03;
|
|
||||||
|
|
||||||
// Modes / Channels
|
|
||||||
public static final byte MODE_BUTTONS = 0x30;
|
|
||||||
public static final byte MODE_BUTTONS_ACCELERATION = 0x31;
|
|
||||||
public static final byte MODE_BUTTONS_ACCELERATION_INFRARED = 0x33;
|
|
||||||
|
|
||||||
// Bluetooth-adress as string representation
|
|
||||||
private String btaddress;
|
|
||||||
|
|
||||||
// LED encoded as byte
|
|
||||||
byte ledencoding;
|
|
||||||
|
|
||||||
// Filters, can filter the data stream
|
|
||||||
protected Vector<Filter> rotfilters = new Vector<Filter>();
|
|
||||||
|
|
||||||
// control connection, send commands to wiimote
|
|
||||||
private L2CAPConnection controlCon;
|
|
||||||
|
|
||||||
// receive connection, receive answers from wiimote
|
|
||||||
private L2CAPConnection receiveCon;
|
|
||||||
|
|
||||||
// Listeners, receive generated events
|
|
||||||
protected Vector<InfraredListener> infraredlistener = new Vector<InfraredListener>();
|
|
||||||
protected Vector<RotationListener> rotationListener = new Vector<RotationListener>();
|
|
||||||
|
|
||||||
// keep track of the orientation
|
|
||||||
private double pitch = 0.0;
|
|
||||||
private double roll = 0.0;
|
|
||||||
private double yaw = 0.0;
|
|
||||||
|
|
||||||
// Functional
|
|
||||||
private boolean vibrating;
|
|
||||||
private boolean calibrated;
|
|
||||||
private boolean infraredEnabled;
|
|
||||||
private WiimoteStreamer wms;
|
|
||||||
private boolean wiiMotionPlusEnabled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new wiimote-device with a specific bluetooth mac-adress.
|
|
||||||
*
|
|
||||||
* @param btaddress
|
|
||||||
* String representation of the mac-adress e.g. 00191D68B57C.
|
|
||||||
* @param autofiltering
|
|
||||||
* If set the wiimote would automatically add the IdleStateFilter.
|
|
||||||
* @param autoconnect
|
|
||||||
* If set the wiimote would automatically be connected.
|
|
||||||
*/
|
|
||||||
public Wiimote(String btaddress, boolean autofiltering, boolean autoconnect) throws IOException {
|
|
||||||
super(autofiltering);
|
|
||||||
this.btaddress = this.removeChar(btaddress, ':');
|
|
||||||
this.vibrating = false;
|
|
||||||
this.setCloseGestureButton(Wiimote.BUTTON_HOME);
|
|
||||||
this.setRecognitionButton(Wiimote.BUTTON_B);
|
|
||||||
this.setTrainButton(Wiimote.BUTTON_A);
|
|
||||||
|
|
||||||
// automatic connect enabled
|
|
||||||
if (autoconnect) {
|
|
||||||
this.connect();
|
|
||||||
this.calibrateAccelerometer();
|
|
||||||
this.streamData(true);
|
|
||||||
this.setLED(1);
|
|
||||||
this.setAccelerationEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the two needed connections to send and receive commands
|
|
||||||
* to and from the wiimote-device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void connect() throws IOException {
|
|
||||||
this.controlCon = (L2CAPConnection) Connector.open("btl2cap://" +
|
|
||||||
this.btaddress + ":11;authenticate=false;encrypt=false;master=false",
|
|
||||||
Connector.WRITE); // 11
|
|
||||||
this.receiveCon = (L2CAPConnection) Connector.open("btl2cap://" +
|
|
||||||
this.btaddress + ":13;authenticate=false;encrypt=false;master=false",
|
|
||||||
Connector.READ); // 13
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnects the wiimote and closes the two connections.
|
|
||||||
*/
|
|
||||||
public void disconnect() {
|
|
||||||
this.vibrating = false;
|
|
||||||
try {
|
|
||||||
this.controlCon.close();
|
|
||||||
this.receiveCon.close();
|
|
||||||
Log.write("Disconnected wiimote.");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.write("Failure during disconnect of wiimote.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
* Receiving data connection
|
|
||||||
*/
|
|
||||||
public L2CAPConnection getReceiveConnection() {
|
|
||||||
return this.receiveCon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method makes the Wiimote-Class reacting to incoming data.
|
|
||||||
* For just controlling and sending commands to the wiimote
|
|
||||||
* (vibration, LEDs, ...) it's not necessary to call this method.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* true, if the class should react to incoming data.
|
|
||||||
* false, if you only want to send commands to wiimote and
|
|
||||||
* only the control-connection is used.
|
|
||||||
*/
|
|
||||||
public void streamData(boolean value) {
|
|
||||||
if (value == true) {
|
|
||||||
if (this.wms == null) {
|
|
||||||
this.wms = new WiimoteStreamer(this);
|
|
||||||
}
|
|
||||||
wms.start();
|
|
||||||
} else if (this.wms != null) {
|
|
||||||
wms.stopThread();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The added Listener will be notified about detected infrated
|
|
||||||
* events.
|
|
||||||
*
|
|
||||||
* @param listener The Listener to be added.
|
|
||||||
*/
|
|
||||||
public void addInfraredListener(InfraredListener listener) {
|
|
||||||
this.infraredlistener.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The added Listener will be notified about detected orientation
|
|
||||||
* changes.
|
|
||||||
*
|
|
||||||
* @param listener The Listener to be added.
|
|
||||||
*/
|
|
||||||
public void addRotationListener(RotationListener listener) {
|
|
||||||
this.rotationListener.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a filter to process the rotation speed data of the
|
|
||||||
* wiimote with an attached Wii Motion Plus.
|
|
||||||
*
|
|
||||||
* @param filter The Filter to be added.
|
|
||||||
*/
|
|
||||||
public void addRotationFilter(Filter filter) {
|
|
||||||
this.rotfilters.add(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets all filters which are applied to the rotation data
|
|
||||||
* from the Wii Motion Plus. Also resets _all_ determined orientation
|
|
||||||
* angles, which should be extended with a consideration of other
|
|
||||||
* external datas - maybe irda events.
|
|
||||||
*/
|
|
||||||
public void resetRotationFilters() {
|
|
||||||
this.yaw = 0.0;
|
|
||||||
this.pitch = 0.0;
|
|
||||||
this.roll = 0.0;
|
|
||||||
for (int i = 0; i < this.rotfilters.size(); i++) {
|
|
||||||
this.rotfilters.elementAt(i).reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write data to a register inside of the wiimote.
|
|
||||||
*
|
|
||||||
* @param offset The memory offset, 3 bytes.
|
|
||||||
* @param data The data to be written, max. 16 bytes.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void writeRegister(byte[] offset, byte[] data) throws IOException {
|
|
||||||
byte[] raw = new byte[23];
|
|
||||||
raw[0] = CMD_SET_REPORT;
|
|
||||||
raw[1] = 0x16; // Write channel
|
|
||||||
raw[2] = 0x04; // Register
|
|
||||||
for (int i = 0; i < offset.length; i++) {
|
|
||||||
raw[3 + i] = offset[i];
|
|
||||||
}
|
|
||||||
raw[6] = (byte) data.length;
|
|
||||||
for (int i = 0; i < data.length; i++) {
|
|
||||||
raw[7 + i] = data[i];
|
|
||||||
}
|
|
||||||
this.sendRaw(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the Wiimote respond the data of an register. The wiimotestreamer
|
|
||||||
* doesn't react to the reponse yet.
|
|
||||||
*
|
|
||||||
* @param offset The memory offset.
|
|
||||||
* @param size The size which has to be read out.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void readRegister(byte[] offset, byte[] size) throws IOException {
|
|
||||||
byte[] raw = new byte[8];
|
|
||||||
raw[0] = CMD_SET_REPORT;
|
|
||||||
raw[1] = 0x17; // Read channel
|
|
||||||
raw[2] = 0x04; // Register
|
|
||||||
for (int i = 0; i < offset.length; i++) {
|
|
||||||
raw[3 + i] = offset[i];
|
|
||||||
}
|
|
||||||
for (int i = 0; i < size.length; i++) {
|
|
||||||
raw[6 + i] = size[i];
|
|
||||||
}
|
|
||||||
this.sendRaw(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads data out of the EEPROM of the wiimote.
|
|
||||||
* At the moment this method is only used to read out the
|
|
||||||
* calibration data, so the wiimotestreamer doesn't react for
|
|
||||||
* every answer on this request.
|
|
||||||
*
|
|
||||||
* @param offset The memory offset.
|
|
||||||
* @param size The size.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void readEEPROM(byte[] offset, byte[] size) throws IOException {
|
|
||||||
byte[] raw = new byte[8];
|
|
||||||
raw[0] = CMD_SET_REPORT;
|
|
||||||
raw[1] = 0x17; // Read channel
|
|
||||||
raw[2] = 0x00; // EEPROM
|
|
||||||
for (int i = 0; i < offset.length; i++) {
|
|
||||||
raw[3 + i] = offset[i];
|
|
||||||
}
|
|
||||||
for (int i = 0; i < size.length; i++) {
|
|
||||||
raw[6 + i] = size[i];
|
|
||||||
}
|
|
||||||
this.sendRaw(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends pure hexdata to the wiimote. If you want your wiimote
|
|
||||||
* to vibrate use sendRaw(new byte[] {0x52, 0x13, 0x01}). For other raw-commands use
|
|
||||||
* the specific wiki-sites around the web (wiili.org, wiibrew.org, ...)
|
|
||||||
* @param raw
|
|
||||||
* byte representation of an command
|
|
||||||
*/
|
|
||||||
public void sendRaw(byte[] raw) throws IOException {
|
|
||||||
if (this.controlCon != null) {
|
|
||||||
this.controlCon.send(raw);
|
|
||||||
try {
|
|
||||||
Thread.sleep(100l);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
System.out.println("sendRaw() interrupted");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables one or more LEDs, where the value could be between 0 and 8.
|
|
||||||
* If value=1 only the left LED would light up, for value=2 the second
|
|
||||||
* led would light up, for value=3 the first and second led would light up,
|
|
||||||
* and so on...
|
|
||||||
*
|
|
||||||
* @param value Between 0 and 8, indicating which LEDs should light up
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void setLED(int value) throws IOException {
|
|
||||||
if (value < 16 && value > 0) {
|
|
||||||
byte tmp = (byte) value;
|
|
||||||
this.ledencoding = (byte) (tmp << 4);
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x11, this.ledencoding});
|
|
||||||
} else {
|
|
||||||
// Random LED change :)
|
|
||||||
this.setLED(new Random().nextInt(16));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the report channel according to the choosen
|
|
||||||
* functions that are enabled (acceleration, irda, ...).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void updateReportChannel() throws IOException {
|
|
||||||
if(!accelerationEnabled
|
|
||||||
&& !wiiMotionPlusEnabled
|
|
||||||
&& !infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x00, 0x30});
|
|
||||||
}
|
|
||||||
else if(accelerationEnabled
|
|
||||||
&& !wiiMotionPlusEnabled
|
|
||||||
&& !infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x04, 0x31});
|
|
||||||
}
|
|
||||||
else if(!accelerationEnabled
|
|
||||||
&& wiiMotionPlusEnabled
|
|
||||||
&& !infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x00, 0x32});
|
|
||||||
}
|
|
||||||
else if(accelerationEnabled
|
|
||||||
&& wiiMotionPlusEnabled
|
|
||||||
&& !infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x04, 0x35});
|
|
||||||
}
|
|
||||||
else if(accelerationEnabled
|
|
||||||
&& !wiiMotionPlusEnabled
|
|
||||||
&& infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x04, 0x33});
|
|
||||||
}
|
|
||||||
else if(accelerationEnabled
|
|
||||||
&& wiiMotionPlusEnabled
|
|
||||||
&& infraredEnabled) {
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x04, 0x37});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// default channel - fallback to button only.
|
|
||||||
Log.write("Invalid Value Configuration: Fallback to Buttons only.");
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x12, 0x00, 0x30});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the calibration of the accerlerometer. This is done once
|
|
||||||
* per each controller in program lifetime.
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void calibrateAccelerometer() throws IOException {
|
|
||||||
this.readEEPROM(new byte[]{0x00, 0x00, 0x20}, new byte[]{0x00, 0x07});
|
|
||||||
this.calibrated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activates the acceleration sensor. You have to call the
|
|
||||||
* streamData(true) method to react to this acceleration data.
|
|
||||||
* Otherwise the wiimote would send data the whole time and
|
|
||||||
* nothing else would happen.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setAccelerationEnabled(boolean enabled) throws IOException {
|
|
||||||
super.setAccelerationEnabled(enabled);
|
|
||||||
if(enabled) {
|
|
||||||
Log.write("Enabling ACCELEROMETER...");
|
|
||||||
this.accelerationEnabled = true;
|
|
||||||
if (!this.calibrated) {
|
|
||||||
this.calibrateAccelerometer();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.write("Disabling ACCELEROMETER...");
|
|
||||||
this.accelerationEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// change channel dynamically
|
|
||||||
this.updateReportChannel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables or disables the infrared camera of the wiimote with
|
|
||||||
* the default values.
|
|
||||||
*
|
|
||||||
* @param e Should the Infrared Camera be enabled.
|
|
||||||
* @throws IOException In case of a connection error.
|
|
||||||
*/
|
|
||||||
public void setInfraredCameraEnabled(boolean enabled) throws IOException {
|
|
||||||
this.setInfraredCameraEnabled(enabled, Wiimote.IR_MODE_STANDARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables the infrared camera in front of the wiimote to track
|
|
||||||
* IR sources in the field of view of the camera. This could be used
|
|
||||||
* to a lot of amazing stuff. Using this Mode could slow down the
|
|
||||||
* recognition of acceleration gestures during the increased data
|
|
||||||
* size transmitted.
|
|
||||||
*
|
|
||||||
* @param e Should the Infrared Camera be enabled.
|
|
||||||
* @param infraredMode The choosen Infrared Camera Mode.
|
|
||||||
* @throws IOException In case of a connection error.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setInfraredCameraEnabled(boolean enabled, byte infraredMode) throws IOException {
|
|
||||||
if(enabled) {
|
|
||||||
Log.write("Enabling INFRARED CAMERA...");
|
|
||||||
this.infraredEnabled = true;
|
|
||||||
|
|
||||||
//write 0x04 to output 0x13
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x13, 0x04});
|
|
||||||
|
|
||||||
// write 0x04 to output 0x1a
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x1a, 0x04});
|
|
||||||
|
|
||||||
// write 0x08 to reguster 0xb00030
|
|
||||||
this.writeRegister(new byte[]{(byte) 0xb0, 0x00, 0x30}, new byte[]{0x08});
|
|
||||||
|
|
||||||
// write sensivity block 1 to register 0xb00000
|
|
||||||
this.writeRegister(new byte[]{(byte) 0xb0, 0x00, 0x00}, new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x90, 0x00, (byte) 0x41});
|
|
||||||
|
|
||||||
// write sensivity block 2 to register 0xb0001a
|
|
||||||
this.writeRegister(new byte[]{(byte) 0xb0, 0x00, (byte) 0x1a}, new byte[]{0x40, 0x00});
|
|
||||||
|
|
||||||
// write ir-mode to register 0xb00033
|
|
||||||
this.writeRegister(new byte[]{(byte) 0xb0, 0x00, 0x33}, new byte[]{infraredMode});
|
|
||||||
} else {
|
|
||||||
Log.write("Disabling INFRARED CAMERA...");
|
|
||||||
this.infraredEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// change channel dynamically
|
|
||||||
this.updateReportChannel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To enable the Wii Motion Plus extension. The wiimote will further get
|
|
||||||
* every other information, like acceleration, infrared camera (loss of precision)
|
|
||||||
* and button presses.
|
|
||||||
*
|
|
||||||
* @throws java.io.IOException
|
|
||||||
*/
|
|
||||||
public void setWiiMotionPlusEnabled(boolean enabled) throws IOException {
|
|
||||||
if(enabled) {
|
|
||||||
Log.write("Enabling WII MOTION PLUS..");
|
|
||||||
this.wiiMotionPlusEnabled = true;
|
|
||||||
// write 0x04 to 0x04a600fe to get wii m+ data within extension reports
|
|
||||||
this.writeRegister(new byte[]{(byte) 0xa6, 0x00, (byte) 0xfe}, new byte[]{0x04});
|
|
||||||
} else {
|
|
||||||
Log.write("Disabling WII MOTION PLUS..");
|
|
||||||
this.wiiMotionPlusEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// change channel dynamically
|
|
||||||
this.updateReportChannel();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* With this method you gain access over the vibrate function of
|
|
||||||
* the wiimote. You got to try which time in milliseconds would
|
|
||||||
* fit your requirements.
|
|
||||||
*
|
|
||||||
* @param milliseconds Time the wiimote would approx. vibrate.
|
|
||||||
*/
|
|
||||||
public void vibrateForTime(long milliseconds) throws IOException {
|
|
||||||
try {
|
|
||||||
if (!vibrating) {
|
|
||||||
this.vibrating = true;
|
|
||||||
byte tmp = (byte) (this.ledencoding | 0x01);
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x11, tmp});
|
|
||||||
Thread.sleep(milliseconds);
|
|
||||||
this.sendRaw(new byte[]{CMD_SET_REPORT, 0x11, this.ledencoding});
|
|
||||||
this.vibrating = false;
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
System.out.println("WiiMoteThread interrupted.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPitch() {
|
|
||||||
return this.pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getYaw() {
|
|
||||||
return this.yaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRoll() {
|
|
||||||
return this.roll;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires a infrared event, containig coordinate pairs (x,y) and a
|
|
||||||
* size of the detected IR spot.
|
|
||||||
*
|
|
||||||
* @param coordinates X and Y display coordinates.
|
|
||||||
* @param size The size of the spot.
|
|
||||||
*/
|
|
||||||
public void fireInfraredEvent(int[][] coordinates, int[] size) {
|
|
||||||
InfraredEvent w = new InfraredEvent(this, coordinates, size);
|
|
||||||
for (int i = 0; i < this.infraredlistener.size(); i++) {
|
|
||||||
this.infraredlistener.get(i).infraredReceived(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires the current relative orientation of the Wiimote to
|
|
||||||
* all RotationListeners.
|
|
||||||
*
|
|
||||||
* @param yaw Orientation around Z axis.
|
|
||||||
* @param roll Orientation around Y axis.
|
|
||||||
* @param pitch Orientation around X axis.
|
|
||||||
*/
|
|
||||||
public void fireRotationEvent(double pitch, double roll, double yaw) {
|
|
||||||
this.pitch = pitch;
|
|
||||||
this.roll = roll;
|
|
||||||
this.yaw = yaw;
|
|
||||||
|
|
||||||
RotationEvent w = new RotationEvent(this, pitch, roll, yaw);
|
|
||||||
for (int i = 0; i < this.rotationListener.size(); i++) {
|
|
||||||
this.rotationListener.elementAt(i).rotationReceived(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a Wii Motion Plus is attached and activated properly this
|
|
||||||
* event could be fired within every change of orientation of the
|
|
||||||
* device. The orientation is not used to do gesture recognition,
|
|
||||||
* yet.
|
|
||||||
*
|
|
||||||
* @param vector The rotational speed vector, containing:
|
|
||||||
* phi - Rotational speed of x axis (pitch)
|
|
||||||
* theta - Rotational speed of y axis (roll)
|
|
||||||
* psi - Rotational speed of z axis (yaw)
|
|
||||||
*/
|
|
||||||
public void fireRotationSpeedEvent(double[] vector) {
|
|
||||||
for (int i = 0; i < this.rotfilters.size(); i++) {
|
|
||||||
vector = this.rotfilters.get(i).filter(vector);
|
|
||||||
// cannot return here if null, because of time-dependent filters
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vector != null) {
|
|
||||||
RotationSpeedEvent w = new RotationSpeedEvent(this, vector[0], vector[1], vector[2]);
|
|
||||||
for (int i = 0; i < this.rotationListener.size(); i++) {
|
|
||||||
this.rotationListener.elementAt(i).rotationSpeedReceived(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate new orientation with integration
|
|
||||||
// do not store new global values here, since they
|
|
||||||
// need regular updates only depended on acceleration values.
|
|
||||||
double tyaw = this.yaw + vector[0] * 0.01;
|
|
||||||
double troll = this.roll + vector[1] * 0.01;
|
|
||||||
double tpitch = this.pitch + vector[2] * 0.01;
|
|
||||||
this.fireRotationEvent(tpitch, troll, tyaw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ###### Hilfsmethoden
|
|
||||||
// TODO
|
|
||||||
private String removeChar(String s, char c) {
|
|
||||||
String r = "";
|
|
||||||
for (int i = 0; i < s.length(); i++) {
|
|
||||||
if (s.charAt(i) != c) {
|
|
||||||
r += s.charAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,398 +0,0 @@
|
|||||||
/*
|
|
||||||
* wiigee - accelerometerbased gesture recognition
|
|
||||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
|
||||||
*
|
|
||||||
* Developed at University of Oldenburg
|
|
||||||
* Contact: wiigee@benjaminpoppinga.de
|
|
||||||
*
|
|
||||||
* This file is part of wiigee.
|
|
||||||
*
|
|
||||||
* wiigee is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
package org.wiigee.device;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.EventObject;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import org.wiigee.util.Log;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class listens to data sended by the wiimote and generates specific
|
|
||||||
* events for acceleration, buttonpress, ...
|
|
||||||
*
|
|
||||||
* @author Benjamin 'BePo' Poppinga
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class WiimoteStreamer extends Thread {
|
|
||||||
|
|
||||||
private boolean running;
|
|
||||||
private int buttonstate;
|
|
||||||
private double x0, x1, y0, y1, z0, z1;
|
|
||||||
private double psi0, theta0, phi0;
|
|
||||||
private boolean wmpcalibrated;
|
|
||||||
private int calibrationcounter;
|
|
||||||
private Vector<double[]> calibrationsequence;
|
|
||||||
private Wiimote wiimote;
|
|
||||||
private L2CAPConnection receiveCon;
|
|
||||||
private EventObject lastevent;
|
|
||||||
|
|
||||||
protected WiimoteStreamer(Wiimote wiimote) {
|
|
||||||
this.wiimote = wiimote;
|
|
||||||
this.receiveCon = wiimote.getReceiveConnection();
|
|
||||||
this.buttonstate = 0;
|
|
||||||
Log.write("WiimoteStreamer initialized...");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Log.write("WiimoteStreamer running...");
|
|
||||||
this.running = true;
|
|
||||||
this.calibrationcounter = 0;
|
|
||||||
this.calibrationsequence = new Vector<double[]>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (running) {
|
|
||||||
// connection has data and we're ready.
|
|
||||||
|
|
||||||
byte[] b = this.getRaw(); // blocks application
|
|
||||||
|
|
||||||
// Log.write("");
|
|
||||||
|
|
||||||
// debug output
|
|
||||||
/* for(int i=0; i<b.length; i++) {
|
|
||||||
* System.out.print((int)b[i]&0xFF); if(i==input.length-1) {
|
|
||||||
* System.out.println(""); } else { System.out.print(":"); } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if((b[1] & 0xFF) == 0x31) {
|
|
||||||
this.handleButtonData(new byte[] { b[2], b[3] });
|
|
||||||
this.handleAccelerationData(new byte[] { b[4], b[5], b[6] });
|
|
||||||
//Log.write("0x31: ManageButton + Acc");
|
|
||||||
}
|
|
||||||
else if ((b[1] & 0xFF) == 0x33) {
|
|
||||||
this.handleButtonData(new byte[] { b[2], b[3] });
|
|
||||||
this.handleAccelerationData(new byte[]{b[4], b[5], b[6]});
|
|
||||||
this.handleInfraredData(new byte[]{b[7], b[8], b[9],
|
|
||||||
b[10], b[11], b[12],
|
|
||||||
b[13], b[14], b[15],
|
|
||||||
b[16], b[17], b[18]});
|
|
||||||
//Log.write("0x33: ManageButton + Acc + Irda");
|
|
||||||
}
|
|
||||||
else if ((b[1] & 0xFF) == 0x37) {
|
|
||||||
this.handleButtonData(new byte[] { b[2], b[3] });
|
|
||||||
this.handleAccelerationData(new byte[]{b[4], b[5], b[6]});
|
|
||||||
this.handleInfraredData(
|
|
||||||
new byte[]{b[7], b[8], b[9], b[10], b[11], b[12],
|
|
||||||
b[13], b[14], b[15], b[16]});
|
|
||||||
this.handleWiiMotionPlusData(
|
|
||||||
new byte[]{b[17], b[18], b[19], b[20], b[21], b[22]});
|
|
||||||
//Log.write("0x37: ManageButton + Acc + Ext");
|
|
||||||
}
|
|
||||||
else if ((b[1] & 0xFF) == 0x21) {
|
|
||||||
this.handleButtonData(new byte[] { b[2], b[3] });
|
|
||||||
|
|
||||||
// calibration data
|
|
||||||
if (((b[5] & 0xFF) == 0x00) && ((b[6] & 0xFF) == 0x20)) {
|
|
||||||
this.handleCalibrationData(
|
|
||||||
new byte[]{b[7], b[8], b[9], b[11], b[12], b[13]});
|
|
||||||
// Log.write("0x21: Calibration result");
|
|
||||||
} else {
|
|
||||||
this.handleRawDataAnswer(
|
|
||||||
new byte[]{b[5], b[6]},
|
|
||||||
new byte[]{b[7], b[8], b[9], b[10], b[11], b[12],
|
|
||||||
b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20],
|
|
||||||
b[21], b[22]
|
|
||||||
});
|
|
||||||
// Log.write("0x21: Raw data answer");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ((b[1] & 0xFF) == (byte) 0x3d) {
|
|
||||||
Log.write("0x3D: Ext only");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Log.write("Unknown data retrieved.");
|
|
||||||
this.printBytes(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // while(running)
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.write("Streamer: Connection to Wiimote lost.");
|
|
||||||
this.running = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles calibration Data
|
|
||||||
*
|
|
||||||
* @param data An array of bytes, containing the data.
|
|
||||||
*/
|
|
||||||
private void handleCalibrationData(byte[] data) {
|
|
||||||
this.x0 = data[0] & 0xFF;
|
|
||||||
this.y0 = data[1] & 0xFF;
|
|
||||||
this.z0 = data[2] & 0xFF;
|
|
||||||
this.x1 = data[3] & 0xFF;
|
|
||||||
this.y1 = data[4] & 0xFF;
|
|
||||||
this.z1 = data[5] & 0xFF;
|
|
||||||
Log.write("Autocalibration successful!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles a raw data answer: It just prints it out.
|
|
||||||
*
|
|
||||||
* @param offset The offset of the maybe read data.
|
|
||||||
* @param data The data itself.
|
|
||||||
*/
|
|
||||||
private void handleRawDataAnswer(byte[] offset, byte[] data) {
|
|
||||||
String out = "";
|
|
||||||
String[] o = this.byte2hex(offset);
|
|
||||||
String[] d = this.byte2hex(data);
|
|
||||||
out += "READ " + o[0] + "" + o[1] + ": ";
|
|
||||||
for (int i = 0; i < d.length; i++) {
|
|
||||||
out += d[i] + " ";
|
|
||||||
}
|
|
||||||
Log.write(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the Wii Motion Plus data to generate orientation
|
|
||||||
* events on the Wiimote.
|
|
||||||
*
|
|
||||||
* @param data The data containing the raw rotation speeds.
|
|
||||||
*/
|
|
||||||
private void handleWiiMotionPlusData(byte[] data) {
|
|
||||||
|
|
||||||
// fixed values until calibration procedure is known
|
|
||||||
//int psi0 = 8265;
|
|
||||||
//int theta0 = 7963;
|
|
||||||
//int phi0 = 7923;
|
|
||||||
|
|
||||||
//this.printBytes(new byte[]{ data[3], data[4], data[5]});
|
|
||||||
|
|
||||||
int psiL = (data[0] & 0xFF);
|
|
||||||
int thetaL = (data[1] & 0xFF);
|
|
||||||
int phiL = (data[2] & 0xFF);
|
|
||||||
|
|
||||||
// cut two lower bits of UPPER values, shift right
|
|
||||||
int psiU = ((data[3] & 0xFC) << 6);
|
|
||||||
int thetaU = ((data[4] & 0xFC) << 6);
|
|
||||||
int phiU = ((data[5] & 0xFC) << 6);
|
|
||||||
|
|
||||||
// add the two values
|
|
||||||
int psiRAW = psiU + psiL;
|
|
||||||
int thetaRAW = thetaU + thetaL;
|
|
||||||
int phiRAW = phiU + phiL;
|
|
||||||
|
|
||||||
// average of 50 samples for calibration
|
|
||||||
if (!this.wmpcalibrated) {
|
|
||||||
if (this.calibrationcounter++ < 50) {
|
|
||||||
this.calibrationsequence.add(new double[]{psiRAW, thetaRAW, phiRAW});
|
|
||||||
} else {
|
|
||||||
this.calibrateWiiMotionPlus();
|
|
||||||
}
|
|
||||||
} else { // is calibrated
|
|
||||||
// calculate degrees per second movement
|
|
||||||
double psi = (double) (psiRAW - psi0) / 20.0;
|
|
||||||
double theta = (double) (thetaRAW - theta0) / 20.0;
|
|
||||||
double phi = (double) (phiRAW - phi0) / 20.0;
|
|
||||||
|
|
||||||
this.wiimote.fireRotationSpeedEvent(new double[]{-psi, -theta, -phi});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build an average of the presaved rotation sequences to have a reference
|
|
||||||
* value for 'not rotating'. This is a kind of calibration until the original
|
|
||||||
* calibration procedure for the wii motion plus is known.
|
|
||||||
*/
|
|
||||||
private void calibrateWiiMotionPlus() {
|
|
||||||
for (int i = 0; i < this.calibrationsequence.size(); i++) {
|
|
||||||
this.psi0 += this.calibrationsequence.elementAt(i)[0];
|
|
||||||
this.theta0 += this.calibrationsequence.elementAt(i)[1];
|
|
||||||
this.phi0 += this.calibrationsequence.elementAt(i)[2];
|
|
||||||
}
|
|
||||||
this.psi0 /= this.calibrationsequence.size();
|
|
||||||
this.theta0 /= this.calibrationsequence.size();
|
|
||||||
this.phi0 /= this.calibrationsequence.size();
|
|
||||||
this.wmpcalibrated = true;
|
|
||||||
Log.write("Wii Motion Plus calibrated manually!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the raw infrared data, containing the spot positions
|
|
||||||
* and the intensities of the spots. At the moment only the
|
|
||||||
* 12 Byte irda raw data is supported.
|
|
||||||
*
|
|
||||||
* @param data 12 Bytes of raw irda data.
|
|
||||||
*/
|
|
||||||
private void handleInfraredData(byte[] data) {
|
|
||||||
int[][] coordinates = new int[4][2];
|
|
||||||
int[] size = new int[] { 1, 1, 1, 1 };
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
// normal mode
|
|
||||||
if(data.length == 10) {
|
|
||||||
for(int i=0; i<10; i+=5) { // for each IR fife-byte segment
|
|
||||||
int tailX1 = data[i] & 0xFF;
|
|
||||||
int tailY1 = data[i+1] & 0xFF;
|
|
||||||
int preY1 = (data[i+2] & 0xC0) << 2;
|
|
||||||
int preX1 = (data[i+2] & 0x30) << 4;
|
|
||||||
int preY2 = (data[i+2] & 0x0C) << 6;
|
|
||||||
int preX2 = (data[i+2] & 0x03) << 8;
|
|
||||||
int tailX2 = data[i+3] & 0xFF;
|
|
||||||
int tailY2 = data[i+4] & 0xFF;
|
|
||||||
|
|
||||||
coordinates[j][0] = tailX1 + preX1;
|
|
||||||
coordinates[j][1] = tailY1 + preY1;
|
|
||||||
coordinates[j+1][0] = tailX2 + preX2;
|
|
||||||
coordinates[j+1][1] = tailY2 + preY2;
|
|
||||||
j+=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (data.length == 12) { // extended mode
|
|
||||||
for (int i = 0; i < 12; i += 3) { // for each IR byte
|
|
||||||
// triple
|
|
||||||
int tailX = data[i] & 0xFF;
|
|
||||||
int tailY = data[i + 1] & 0xFF;
|
|
||||||
int preY = (data[i + 2] & 0xC0) << 2;
|
|
||||||
int preX = (data[i + 2] & 0x30) << 4;
|
|
||||||
|
|
||||||
coordinates[j][0] = tailX + preX;
|
|
||||||
coordinates[j][1] = tailY + preY;
|
|
||||||
size[j++] = (data[i + 2] & 0x0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wiimote.fireInfraredEvent(coordinates, size);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the retrieved acceleration data and fires
|
|
||||||
* corresponding Acceleration Event on the Device.
|
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
private void handleAccelerationData(byte[] data) {
|
|
||||||
// convert to int.
|
|
||||||
int xraw = (data[0] & 0xFF);
|
|
||||||
int yraw = (data[1] & 0xFF);
|
|
||||||
int zraw = (data[2] & 0xFF);
|
|
||||||
|
|
||||||
// calculate acceleration with calibration data.
|
|
||||||
double x = (double) (xraw - x0) / (double) (x1 - x0);
|
|
||||||
double y = (double) (yraw - y0) / (double) (y1 - y0);
|
|
||||||
double z = (double) (zraw - z0) / (double) (z1 - z0);
|
|
||||||
|
|
||||||
this.wiimote.fireAccelerationEvent(new double[]{x, y, z});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes the two bytes with the button press and release bits.
|
|
||||||
*
|
|
||||||
* @param a First button byte.
|
|
||||||
* @param b Second button byte.
|
|
||||||
*/
|
|
||||||
private void handleButtonData(byte[] data) {
|
|
||||||
byte first = (byte)(data[0] & 0xFF);
|
|
||||||
byte second = (byte)(data[1] & 0xFF);
|
|
||||||
int newbuttons = (first<<8) + second;
|
|
||||||
|
|
||||||
int delta = this.buttonstate ^ newbuttons; // XOR
|
|
||||||
|
|
||||||
int shift = 0x0001;
|
|
||||||
while(shift<0x1000) {
|
|
||||||
if(shift!=0x0020 && shift!=0x0040) { // reserved bytes
|
|
||||||
if((delta&shift)==shift) { // change detected
|
|
||||||
if((newbuttons&shift)==shift) { // press detected
|
|
||||||
this.wiimote.fireButtonPressedEvent(shift);
|
|
||||||
} else { // release detected
|
|
||||||
this.wiimote.fireButtonReleasedEvent(shift);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shift<<=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.buttonstate = newbuttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets 23 bytes out of the Receive Connection Stream.
|
|
||||||
*
|
|
||||||
* @return The 23 retrieved bytes.
|
|
||||||
* @throws java.io.IOException
|
|
||||||
*/
|
|
||||||
private byte[] getRaw() throws IOException {
|
|
||||||
byte[] b = new byte[23];
|
|
||||||
this.receiveCon.receive(b);
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops this thread.
|
|
||||||
*/
|
|
||||||
protected void stopThread() {
|
|
||||||
this.running = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* true if thread is running.
|
|
||||||
* @return true if thread is running, false otherwise.
|
|
||||||
*/
|
|
||||||
protected boolean isRunning() {
|
|
||||||
return this.running;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints a byte stream as hex string.
|
|
||||||
* @param b
|
|
||||||
*/
|
|
||||||
private void printBytes(byte[] b) {
|
|
||||||
String out = "";
|
|
||||||
String[] s = this.byte2hex(b);
|
|
||||||
for (int i = 0; i < s.length; i++) {
|
|
||||||
out += " " + s[i];
|
|
||||||
}
|
|
||||||
Log.write(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a byte array to a string array.
|
|
||||||
*
|
|
||||||
* @param b
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String[] byte2hex(byte[] b) {
|
|
||||||
String[] out = new String[b.length];
|
|
||||||
String stmp = "";
|
|
||||||
for (int n = 0; n < b.length; n++) {
|
|
||||||
stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
|
|
||||||
if (stmp.length() == 1) {
|
|
||||||
out[n] = ("0" + stmp).toUpperCase();
|
|
||||||
} else {
|
|
||||||
out[n] = stmp.toUpperCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* wiigee - accelerometerbased gesture recognition
|
|
||||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
|
||||||
*
|
|
||||||
* Developed at University of Oldenburg
|
|
||||||
* Contact: wiigee@benjaminpoppinga.de
|
|
||||||
*
|
|
||||||
* This file is part of wiigee.
|
|
||||||
*
|
|
||||||
* wiigee is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
package org.wiigee.filter;
|
|
||||||
|
|
||||||
import org.wiigee.device.Wiimote;
|
|
||||||
import org.wiigee.util.Log;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes rotation events which are for all axis
|
|
||||||
* under a defined threshold value (which default is 2.0 degrees
|
|
||||||
* per second TBD).
|
|
||||||
*
|
|
||||||
* @author Benjamin 'BePo' Poppinga
|
|
||||||
*/
|
|
||||||
public class RotationResetFilter extends Filter {
|
|
||||||
|
|
||||||
private Wiimote device;
|
|
||||||
|
|
||||||
public RotationResetFilter(Wiimote source) {
|
|
||||||
super();
|
|
||||||
this.device = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
// nothing to reset here
|
|
||||||
}
|
|
||||||
|
|
||||||
public double[] filterAlgorithm(double[] vector) {
|
|
||||||
double abs = Math.sqrt(vector[0]*vector[0]+
|
|
||||||
vector[1]*vector[1]+
|
|
||||||
vector[2]*vector[2]);
|
|
||||||
|
|
||||||
if(abs<=1.05 && abs>=0.95) { // wiimote is idle
|
|
||||||
|
|
||||||
//roll = arctan2(ax,sqrt(ay2+az2))
|
|
||||||
//pitch = arctan2(ay,sqrt(ax2+az2))
|
|
||||||
|
|
||||||
double tphi = Math.toDegrees(Math.atan2(vector[0], Math.sqrt(vector[1]*vector[1]+vector[2]*vector[2])));
|
|
||||||
double ttheta = Math.toDegrees(Math.atan2(vector[1], Math.sqrt(vector[0]*vector[0]+vector[2]*vector[2])));
|
|
||||||
this.device.fireRotationEvent(tphi, ttheta, this.device.getYaw());
|
|
||||||
Log.write("reset rotation using acceleration. pitch="+tphi+" roll="+ttheta);
|
|
||||||
}
|
|
||||||
return vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import wiiusej.WiiUseApiManager;
|
|
||||||
import wiiusej.Wiimote;
|
|
||||||
import wiiusej.utils.ClassicControllerButtonsEventPanel;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ClassicControllerEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This frame is used to display events from a classic controller.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class ClassicControllerGuiTest extends javax.swing.JFrame implements WiimoteListener {
|
|
||||||
|
|
||||||
private Wiimote wiimote;
|
|
||||||
private static int MAX_SHOULDER = 100;
|
|
||||||
|
|
||||||
/** Creates new form ClassicControllerGuiTest */
|
|
||||||
public ClassicControllerGuiTest(Wiimote wiimote) {
|
|
||||||
initComponents();
|
|
||||||
this.wiimote = wiimote;
|
|
||||||
registerListeners();
|
|
||||||
leftShoulderBar.setMaximum(MAX_SHOULDER);
|
|
||||||
rightShoulderBar.setMaximum(MAX_SHOULDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerListeners() {
|
|
||||||
wiimote.addWiiMoteEventListeners(this);
|
|
||||||
wiimote.addWiiMoteEventListeners((ClassicControllerButtonsEventPanel) classicControllerPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unRegisterListeners() {
|
|
||||||
wiimote.removeWiiMoteEventListeners(this);
|
|
||||||
wiimote.removeWiiMoteEventListeners((ClassicControllerButtonsEventPanel) classicControllerPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
shouldersPanel = new javax.swing.JPanel();
|
|
||||||
leftShoulderBar = new javax.swing.JProgressBar();
|
|
||||||
rightShoulderBar = new javax.swing.JProgressBar();
|
|
||||||
classicControllerPanel = new wiiusej.utils.ClassicControllerButtonsEventPanel();
|
|
||||||
|
|
||||||
setTitle("WiiuseJ Classic Controller Test GUI");
|
|
||||||
setResizable(false);
|
|
||||||
getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));
|
|
||||||
|
|
||||||
shouldersPanel.setMaximumSize(new java.awt.Dimension(350, 16));
|
|
||||||
shouldersPanel.setMinimumSize(new java.awt.Dimension(350, 16));
|
|
||||||
shouldersPanel.setPreferredSize(new java.awt.Dimension(350, 16));
|
|
||||||
shouldersPanel.setLayout(new javax.swing.BoxLayout(shouldersPanel, javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
shouldersPanel.add(leftShoulderBar);
|
|
||||||
shouldersPanel.add(rightShoulderBar);
|
|
||||||
|
|
||||||
getContentPane().add(shouldersPanel);
|
|
||||||
|
|
||||||
classicControllerPanel.setMaximumSize(new java.awt.Dimension(350, 182));
|
|
||||||
classicControllerPanel.setMinimumSize(new java.awt.Dimension(350, 182));
|
|
||||||
|
|
||||||
javax.swing.GroupLayout classicControllerPanelLayout = new javax.swing.GroupLayout(classicControllerPanel);
|
|
||||||
classicControllerPanel.setLayout(classicControllerPanelLayout);
|
|
||||||
classicControllerPanelLayout.setHorizontalGroup(
|
|
||||||
classicControllerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 350, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
classicControllerPanelLayout.setVerticalGroup(
|
|
||||||
classicControllerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 182, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
getContentPane().add(classicControllerPanel);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
if (arg0 instanceof ClassicControllerEvent) {
|
|
||||||
ClassicControllerEvent classicController = (ClassicControllerEvent) arg0;
|
|
||||||
float leftShoulder = classicController.getLeftShoulder();
|
|
||||||
float rightShoulder = classicController.getRightShoulder();
|
|
||||||
leftShoulderBar.setValue(Math.round(leftShoulder * MAX_SHOULDER));
|
|
||||||
rightShoulderBar.setValue(Math.round(rightShoulder * MAX_SHOULDER));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
|
|
||||||
ClassicControllerGuiTest gui = null;
|
|
||||||
if (wiimotes.length > 0) {
|
|
||||||
gui = new ClassicControllerGuiTest(wiimotes[0]);
|
|
||||||
}
|
|
||||||
gui.setDefaultCloseOperation(WiiuseJGuiTest.EXIT_ON_CLOSE);
|
|
||||||
gui.setVisible(true);
|
|
||||||
}
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JPanel classicControllerPanel;
|
|
||||||
private javax.swing.JProgressBar leftShoulderBar;
|
|
||||||
private javax.swing.JProgressBar rightShoulderBar;
|
|
||||||
private javax.swing.JPanel shouldersPanel;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.awt.event.WindowListener;
|
|
||||||
|
|
||||||
import wiiusej.WiiUseApiManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is used to close wiiusej cleanly.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class CloseGuiTestCleanly implements WindowListener {
|
|
||||||
|
|
||||||
public void windowOpened(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowClosing(WindowEvent e) {
|
|
||||||
WiiUseApiManager.definitiveShutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowClosed(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowIconified(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowDeiconified(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowActivated(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void windowDeactivated(WindowEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
/*
|
|
||||||
* GuitarHeroGUITest.java
|
|
||||||
*
|
|
||||||
* Created on 12 juin 2008, 23:10
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import wiiusej.Wiimote;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This frame is used to display events from a Guitar Hero 3.
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class GuitarHero3GuiTest extends javax.swing.JFrame implements WiimoteListener {
|
|
||||||
|
|
||||||
private Wiimote wiimote;
|
|
||||||
private static int MAX_WHAMMY_BAR = 100;
|
|
||||||
|
|
||||||
/** Creates new form GuitarHeroGUITest */
|
|
||||||
public GuitarHero3GuiTest(Wiimote wiimote) {
|
|
||||||
initComponents();
|
|
||||||
this.wiimote = wiimote;
|
|
||||||
whammyProgressBar.setMaximum(MAX_WHAMMY_BAR);
|
|
||||||
registerListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerListeners() {
|
|
||||||
wiimote.addWiiMoteEventListeners(this);
|
|
||||||
//register panel buttons
|
|
||||||
wiimote.addWiiMoteEventListeners(guitarHero3ButtonsEventPanel);
|
|
||||||
//register joystick panel
|
|
||||||
wiimote.addWiiMoteEventListeners(guitarHero3JoystickPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unRegisterListeners() {
|
|
||||||
wiimote.removeWiiMoteEventListeners(this);
|
|
||||||
wiimote.removeWiiMoteEventListeners(guitarHero3ButtonsEventPanel);
|
|
||||||
wiimote.removeWiiMoteEventListeners(guitarHero3JoystickPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
buttonsEventPanel = new javax.swing.JPanel();
|
|
||||||
guitarHero3ButtonsEventPanel = new wiiusej.utils.GuitarHero3ButtonsEventPanel();
|
|
||||||
bottomPanel = new javax.swing.JPanel();
|
|
||||||
guitarHero3JoystickPanel = new wiiusej.utils.GuitarHeroJoystickEventPanel();
|
|
||||||
whammyProgressBar = new javax.swing.JProgressBar();
|
|
||||||
|
|
||||||
setTitle("WiiuseJ Guitar Hero 3 Test GUI");
|
|
||||||
getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));
|
|
||||||
|
|
||||||
buttonsEventPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
|
|
||||||
javax.swing.GroupLayout buttonsEventPanelLayout = new javax.swing.GroupLayout(buttonsEventPanel);
|
|
||||||
buttonsEventPanel.setLayout(buttonsEventPanelLayout);
|
|
||||||
buttonsEventPanelLayout.setHorizontalGroup(
|
|
||||||
buttonsEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 526, Short.MAX_VALUE)
|
|
||||||
.addGroup(buttonsEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(buttonsEventPanelLayout.createSequentialGroup()
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
|
||||||
.addComponent(guitarHero3ButtonsEventPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)))
|
|
||||||
);
|
|
||||||
buttonsEventPanelLayout.setVerticalGroup(
|
|
||||||
buttonsEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 96, Short.MAX_VALUE)
|
|
||||||
.addGroup(buttonsEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(buttonsEventPanelLayout.createSequentialGroup()
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
|
||||||
.addComponent(guitarHero3ButtonsEventPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE)))
|
|
||||||
);
|
|
||||||
|
|
||||||
getContentPane().add(buttonsEventPanel);
|
|
||||||
|
|
||||||
bottomPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
bottomPanel.setLayout(new javax.swing.BoxLayout(bottomPanel, javax.swing.BoxLayout.X_AXIS));
|
|
||||||
bottomPanel.add(guitarHero3JoystickPanel);
|
|
||||||
|
|
||||||
whammyProgressBar.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
whammyProgressBar.setForeground(new java.awt.Color(255, 0, 255));
|
|
||||||
bottomPanel.add(whammyProgressBar);
|
|
||||||
|
|
||||||
getContentPane().add(bottomPanel);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
if (arg0 instanceof GuitarHeroEvent) {
|
|
||||||
GuitarHeroEvent guitar = (GuitarHeroEvent) arg0;
|
|
||||||
//move progress bar for whammy bar
|
|
||||||
whammyProgressBar.setValue(Math.round(MAX_WHAMMY_BAR*guitar.getWhammyBar()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JPanel bottomPanel;
|
|
||||||
private javax.swing.JPanel buttonsEventPanel;
|
|
||||||
private wiiusej.utils.GuitarHero3ButtonsEventPanel guitarHero3ButtonsEventPanel;
|
|
||||||
private wiiusej.utils.GuitarHeroJoystickEventPanel guitarHero3JoystickPanel;
|
|
||||||
private javax.swing.JProgressBar whammyProgressBar;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import wiiusej.WiiUseApiManager;
|
|
||||||
import wiiusej.Wiimote;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NetworkClient Class to launch WiiuseJ GUI Test.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class Main {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
* the command line arguments
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
|
|
||||||
WiiuseJGuiTest gui = null;
|
|
||||||
if (wiimotes.length > 0) {
|
|
||||||
gui = new WiiuseJGuiTest(wiimotes[0]);
|
|
||||||
} else {
|
|
||||||
gui = new WiiuseJGuiTest();
|
|
||||||
}
|
|
||||||
gui.setDefaultCloseOperation(WiiuseJGuiTest.EXIT_ON_CLOSE);
|
|
||||||
gui.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,450 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import wiiusej.Wiimote;
|
|
||||||
import wiiusej.utils.AccelerationExpansionEventPanel;
|
|
||||||
import wiiusej.utils.AccelerationPanel;
|
|
||||||
import wiiusej.utils.GForceExpansionEventPanel;
|
|
||||||
import wiiusej.utils.GForcePanel;
|
|
||||||
import wiiusej.utils.NunchukJoystickEventPanel;
|
|
||||||
import wiiusej.utils.OrientationExpansionEventPanel;
|
|
||||||
import wiiusej.utils.OrientationPanel;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This frame is used to display events from a nunchuk.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class NunchukGuiTest extends javax.swing.JFrame implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Wiimote wiimote;
|
|
||||||
private boolean isThresholdsRequested = true;
|
|
||||||
|
|
||||||
/** Creates new form NunchukGuiTest */
|
|
||||||
public NunchukGuiTest(Wiimote wiimote) {
|
|
||||||
initComponents();
|
|
||||||
this.wiimote = wiimote;
|
|
||||||
registerListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerListeners() {
|
|
||||||
wiimote.addWiiMoteEventListeners(this);
|
|
||||||
wiimote.addWiiMoteEventListeners((OrientationPanel) orientationPanel);
|
|
||||||
wiimote.addWiiMoteEventListeners((GForcePanel) gForcePanel);
|
|
||||||
wiimote
|
|
||||||
.addWiiMoteEventListeners((AccelerationPanel) rawAccelerationPanel);
|
|
||||||
wiimote
|
|
||||||
.addWiiMoteEventListeners((NunchukJoystickEventPanel) joystickEventsPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unRegisterListeners() {
|
|
||||||
wiimote
|
|
||||||
.removeWiiMoteEventListeners((OrientationPanel) orientationPanel);
|
|
||||||
wiimote.removeWiiMoteEventListeners((GForcePanel) gForcePanel);
|
|
||||||
wiimote
|
|
||||||
.removeWiiMoteEventListeners((AccelerationPanel) rawAccelerationPanel);
|
|
||||||
wiimote
|
|
||||||
.removeWiiMoteEventListeners((NunchukJoystickEventPanel) joystickEventsPanel);
|
|
||||||
wiimote.removeWiiMoteEventListeners(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void requestThresholdsUpdate() {
|
|
||||||
isThresholdsRequested = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
topPanels = new javax.swing.JPanel();
|
|
||||||
joystickEventsPanel = new NunchukJoystickEventPanel();
|
|
||||||
motionSensingEventsPanel = new javax.swing.JPanel();
|
|
||||||
motionSensingEventsTabbedPanels = new javax.swing.JTabbedPane();
|
|
||||||
rawAccelerationPanel = new AccelerationExpansionEventPanel();
|
|
||||||
orientationPanel = new OrientationExpansionEventPanel();
|
|
||||||
gForcePanel = new GForceExpansionEventPanel();
|
|
||||||
setNunchukValuesPanel = new javax.swing.JPanel();
|
|
||||||
nunchukButtonsEventPanel = new javax.swing.JPanel();
|
|
||||||
cButton = new javax.swing.JButton();
|
|
||||||
zButton = new javax.swing.JButton();
|
|
||||||
nunchukOrientationPanel = new javax.swing.JPanel();
|
|
||||||
nunchukOrientationTextField = new javax.swing.JTextField();
|
|
||||||
nunchukOrientationButton = new javax.swing.JButton();
|
|
||||||
nunchukAccelerationPanel = new javax.swing.JPanel();
|
|
||||||
nunchukAccelerationTextField = new javax.swing.JTextField();
|
|
||||||
nunchukAccelerationButton = new javax.swing.JButton();
|
|
||||||
messagePanel = new javax.swing.JPanel();
|
|
||||||
messageText = new javax.swing.JLabel();
|
|
||||||
|
|
||||||
setTitle("WiiuseJ Nunchuk Test GUI");
|
|
||||||
setMinimumSize(new java.awt.Dimension(400, 400));
|
|
||||||
getContentPane().setLayout(
|
|
||||||
new javax.swing.BoxLayout(getContentPane(),
|
|
||||||
javax.swing.BoxLayout.Y_AXIS));
|
|
||||||
|
|
||||||
topPanels.setMinimumSize(new java.awt.Dimension(400, 200));
|
|
||||||
topPanels.setPreferredSize(new java.awt.Dimension(400, 200));
|
|
||||||
topPanels.setLayout(new javax.swing.BoxLayout(topPanels,
|
|
||||||
javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
|
|
||||||
joystickEventsPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
joystickEventsPanel.setBorder(javax.swing.BorderFactory
|
|
||||||
.createTitledBorder(new javax.swing.border.LineBorder(
|
|
||||||
new java.awt.Color(51, 153, 0), 2, true),
|
|
||||||
"Joystick View",
|
|
||||||
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
|
|
||||||
javax.swing.border.TitledBorder.DEFAULT_POSITION,
|
|
||||||
new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(
|
|
||||||
204, 102, 0)));
|
|
||||||
joystickEventsPanel.setToolTipText("JoystickEvent");
|
|
||||||
joystickEventsPanel.setMinimumSize(new java.awt.Dimension(200, 200));
|
|
||||||
|
|
||||||
javax.swing.GroupLayout joystickEventsPanelLayout = new javax.swing.GroupLayout(
|
|
||||||
joystickEventsPanel);
|
|
||||||
joystickEventsPanel.setLayout(joystickEventsPanelLayout);
|
|
||||||
joystickEventsPanelLayout.setHorizontalGroup(joystickEventsPanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 601, Short.MAX_VALUE));
|
|
||||||
joystickEventsPanelLayout.setVerticalGroup(joystickEventsPanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 174, Short.MAX_VALUE));
|
|
||||||
|
|
||||||
topPanels.add(joystickEventsPanel);
|
|
||||||
joystickEventsPanel.getAccessibleContext()
|
|
||||||
.setAccessibleName("Joystick");
|
|
||||||
|
|
||||||
motionSensingEventsPanel
|
|
||||||
.setMinimumSize(new java.awt.Dimension(200, 200));
|
|
||||||
|
|
||||||
rawAccelerationPanel.setToolTipText("Nunchuk MotionSensingEvent");
|
|
||||||
|
|
||||||
javax.swing.GroupLayout rawAccelerationPanelLayout = new javax.swing.GroupLayout(
|
|
||||||
rawAccelerationPanel);
|
|
||||||
rawAccelerationPanel.setLayout(rawAccelerationPanelLayout);
|
|
||||||
rawAccelerationPanelLayout
|
|
||||||
.setHorizontalGroup(rawAccelerationPanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 597, Short.MAX_VALUE));
|
|
||||||
rawAccelerationPanelLayout.setVerticalGroup(rawAccelerationPanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 175, Short.MAX_VALUE));
|
|
||||||
|
|
||||||
motionSensingEventsTabbedPanels.addTab("RawAcceleration",
|
|
||||||
rawAccelerationPanel);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout orientationPanelLayout = new javax.swing.GroupLayout(
|
|
||||||
orientationPanel);
|
|
||||||
orientationPanel.setLayout(orientationPanelLayout);
|
|
||||||
orientationPanelLayout.setHorizontalGroup(orientationPanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 597, Short.MAX_VALUE));
|
|
||||||
orientationPanelLayout.setVerticalGroup(orientationPanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 175, Short.MAX_VALUE));
|
|
||||||
|
|
||||||
motionSensingEventsTabbedPanels.addTab("Orientation", orientationPanel);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout gForcePanelLayout = new javax.swing.GroupLayout(
|
|
||||||
gForcePanel);
|
|
||||||
gForcePanel.setLayout(gForcePanelLayout);
|
|
||||||
gForcePanelLayout.setHorizontalGroup(gForcePanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 597, Short.MAX_VALUE));
|
|
||||||
gForcePanelLayout.setVerticalGroup(gForcePanelLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 175, Short.MAX_VALUE));
|
|
||||||
|
|
||||||
motionSensingEventsTabbedPanels.addTab("GForce", gForcePanel);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout motionSensingEventsPanelLayout = new javax.swing.GroupLayout(
|
|
||||||
motionSensingEventsPanel);
|
|
||||||
motionSensingEventsPanel.setLayout(motionSensingEventsPanelLayout);
|
|
||||||
motionSensingEventsPanelLayout
|
|
||||||
.setHorizontalGroup(motionSensingEventsPanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(motionSensingEventsTabbedPanels,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE, 602,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
motionSensingEventsPanelLayout
|
|
||||||
.setVerticalGroup(motionSensingEventsPanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(motionSensingEventsTabbedPanels,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE, 200,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
|
|
||||||
topPanels.add(motionSensingEventsPanel);
|
|
||||||
|
|
||||||
getContentPane().add(topPanels);
|
|
||||||
|
|
||||||
setNunchukValuesPanel.setMinimumSize(new java.awt.Dimension(400, 200));
|
|
||||||
setNunchukValuesPanel
|
|
||||||
.setPreferredSize(new java.awt.Dimension(400, 200));
|
|
||||||
setNunchukValuesPanel.setLayout(new javax.swing.BoxLayout(
|
|
||||||
setNunchukValuesPanel, javax.swing.BoxLayout.Y_AXIS));
|
|
||||||
|
|
||||||
nunchukButtonsEventPanel.setToolTipText("Nunchuk ButtonsEvent");
|
|
||||||
nunchukButtonsEventPanel
|
|
||||||
.setMinimumSize(new java.awt.Dimension(100, 100));
|
|
||||||
nunchukButtonsEventPanel.setPreferredSize(new java.awt.Dimension(100,
|
|
||||||
100));
|
|
||||||
nunchukButtonsEventPanel.setLayout(new javax.swing.BoxLayout(
|
|
||||||
nunchukButtonsEventPanel, javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
|
|
||||||
cButton.setText("C");
|
|
||||||
cButton.setMaximumSize(new java.awt.Dimension(50, 50));
|
|
||||||
cButton.setMinimumSize(new java.awt.Dimension(50, 50));
|
|
||||||
cButton.setPreferredSize(new java.awt.Dimension(50, 50));
|
|
||||||
nunchukButtonsEventPanel.add(cButton);
|
|
||||||
|
|
||||||
zButton.setText("Z");
|
|
||||||
zButton.setMaximumSize(new java.awt.Dimension(50, 50));
|
|
||||||
zButton.setMinimumSize(new java.awt.Dimension(50, 50));
|
|
||||||
zButton.setPreferredSize(new java.awt.Dimension(50, 50));
|
|
||||||
nunchukButtonsEventPanel.add(zButton);
|
|
||||||
|
|
||||||
setNunchukValuesPanel.add(nunchukButtonsEventPanel);
|
|
||||||
|
|
||||||
nunchukOrientationTextField.setPreferredSize(new java.awt.Dimension(60,
|
|
||||||
20));
|
|
||||||
nunchukOrientationPanel.add(nunchukOrientationTextField);
|
|
||||||
|
|
||||||
nunchukOrientationButton.setText("Set Orientation Threshold");
|
|
||||||
nunchukOrientationButton
|
|
||||||
.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
nunchukOrientationButtonMousePressed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nunchukOrientationPanel.add(nunchukOrientationButton);
|
|
||||||
|
|
||||||
setNunchukValuesPanel.add(nunchukOrientationPanel);
|
|
||||||
|
|
||||||
nunchukAccelerationTextField.setPreferredSize(new java.awt.Dimension(
|
|
||||||
60, 20));
|
|
||||||
nunchukAccelerationPanel.add(nunchukAccelerationTextField);
|
|
||||||
|
|
||||||
nunchukAccelerationButton.setText("Set Acceleration Threshold");
|
|
||||||
nunchukAccelerationButton
|
|
||||||
.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
nunchukAccelerationButtonMousePressed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nunchukAccelerationPanel.add(nunchukAccelerationButton);
|
|
||||||
|
|
||||||
setNunchukValuesPanel.add(nunchukAccelerationPanel);
|
|
||||||
|
|
||||||
messageText.setText("Message:");
|
|
||||||
|
|
||||||
javax.swing.GroupLayout messagePanelLayout = new javax.swing.GroupLayout(
|
|
||||||
messagePanel);
|
|
||||||
messagePanel.setLayout(messagePanelLayout);
|
|
||||||
messagePanelLayout
|
|
||||||
.setHorizontalGroup(messagePanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 1216, Short.MAX_VALUE)
|
|
||||||
.addGroup(
|
|
||||||
messagePanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(
|
|
||||||
messagePanelLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addGap(0, 0,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addComponent(
|
|
||||||
messageText)
|
|
||||||
.addGap(0, 0,
|
|
||||||
Short.MAX_VALUE))));
|
|
||||||
messagePanelLayout
|
|
||||||
.setVerticalGroup(messagePanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 34, Short.MAX_VALUE)
|
|
||||||
.addGroup(
|
|
||||||
messagePanelLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(
|
|
||||||
messagePanelLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addGap(0, 0,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addComponent(
|
|
||||||
messageText)
|
|
||||||
.addGap(0, 0,
|
|
||||||
Short.MAX_VALUE))));
|
|
||||||
|
|
||||||
setNunchukValuesPanel.add(messagePanel);
|
|
||||||
|
|
||||||
getContentPane().add(setNunchukValuesPanel);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void nunchukOrientationButtonMousePressed(
|
|
||||||
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_nunchukOrientationButtonMousePressed
|
|
||||||
try {
|
|
||||||
float nb = Float.parseFloat(nunchukOrientationTextField.getText());
|
|
||||||
wiimote.setNunchukOrientationThreshold(nb);
|
|
||||||
messageText.setText("Nunchuk orientation threshold set to " + nb);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
messageText
|
|
||||||
.setText("Number is not an integer, nunchuk orientation threshold not set !");
|
|
||||||
}
|
|
||||||
}// GEN-LAST:event_nunchukOrientationButtonMousePressed
|
|
||||||
|
|
||||||
private void nunchukAccelerationButtonMousePressed(
|
|
||||||
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_nunchukAccelerationButtonMousePressed
|
|
||||||
try {
|
|
||||||
int nb = Integer.parseInt(nunchukAccelerationTextField.getText());
|
|
||||||
wiimote.setNunchukAccelerationThreshold(nb);
|
|
||||||
messageText.setText("Nunchuk acceleration threshold set to " + nb);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
messageText
|
|
||||||
.setText("Number is not an integer, nunchuk acceleration threshold not set !");
|
|
||||||
}
|
|
||||||
}// GEN-LAST:event_nunchukAccelerationButtonMousePressed
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
if (arg0 instanceof NunchukEvent) {
|
|
||||||
NunchukEvent nunchuk = (NunchukEvent) arg0;
|
|
||||||
NunchukButtonsEvent buttons = nunchuk.getButtonsEvent();
|
|
||||||
|
|
||||||
//C button
|
|
||||||
if (buttons.isButtonCJustPressed()) {
|
|
||||||
cButton.setEnabled(false);
|
|
||||||
}else if (buttons.isButtonCJustReleased()) {
|
|
||||||
cButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Z button
|
|
||||||
if(buttons.isButtonZJustPressed()) {
|
|
||||||
zButton.setEnabled(false);
|
|
||||||
}else if (buttons.isButtonZJustReleased()) {
|
|
||||||
zButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (isThresholdsRequested) {
|
|
||||||
MotionSensingEvent evt = nunchuk.getNunchukMotionSensingEvent();
|
|
||||||
nunchukAccelerationTextField.setText(evt
|
|
||||||
.getAccelerationThreshold()
|
|
||||||
+ "");
|
|
||||||
nunchukOrientationTextField.setText(evt
|
|
||||||
.getOrientationThreshold()
|
|
||||||
+ "");
|
|
||||||
isThresholdsRequested = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JButton cButton;
|
|
||||||
private javax.swing.JPanel gForcePanel;
|
|
||||||
private javax.swing.JPanel joystickEventsPanel;
|
|
||||||
private javax.swing.JPanel messagePanel;
|
|
||||||
private javax.swing.JLabel messageText;
|
|
||||||
private javax.swing.JPanel motionSensingEventsPanel;
|
|
||||||
private javax.swing.JTabbedPane motionSensingEventsTabbedPanels;
|
|
||||||
private javax.swing.JButton nunchukAccelerationButton;
|
|
||||||
private javax.swing.JPanel nunchukAccelerationPanel;
|
|
||||||
private javax.swing.JTextField nunchukAccelerationTextField;
|
|
||||||
private javax.swing.JPanel nunchukButtonsEventPanel;
|
|
||||||
private javax.swing.JButton nunchukOrientationButton;
|
|
||||||
private javax.swing.JPanel nunchukOrientationPanel;
|
|
||||||
private javax.swing.JTextField nunchukOrientationTextField;
|
|
||||||
private javax.swing.JPanel orientationPanel;
|
|
||||||
private javax.swing.JPanel rawAccelerationPanel;
|
|
||||||
private javax.swing.JPanel setNunchukValuesPanel;
|
|
||||||
private javax.swing.JPanel topPanels;
|
|
||||||
private javax.swing.JButton zButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,389 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.test;
|
|
||||||
|
|
||||||
import java.awt.AWTException;
|
|
||||||
import java.awt.Robot;
|
|
||||||
import java.awt.event.InputEvent;
|
|
||||||
|
|
||||||
import wiiusej.WiiUseApiManager;
|
|
||||||
import wiiusej.Wiimote;
|
|
||||||
import wiiusej.values.IRSource;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class used to test WiiuseJ in text mode.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class Tests implements WiimoteListener {
|
|
||||||
|
|
||||||
Robot robot;
|
|
||||||
|
|
||||||
private static int DISPLAY_EACH_VALUE = 1;
|
|
||||||
private static int DUMP = 2;
|
|
||||||
private static int MOVE_MOUSE = 3;
|
|
||||||
private static int TEST_LEDS = 5;
|
|
||||||
|
|
||||||
private Wiimote wiimote;
|
|
||||||
|
|
||||||
int dump = DISPLAY_EACH_VALUE;
|
|
||||||
|
|
||||||
public Tests(Wiimote wim) {
|
|
||||||
wiimote = wim;
|
|
||||||
wiimote.addWiiMoteEventListeners(this);
|
|
||||||
try {
|
|
||||||
robot = new Robot();
|
|
||||||
} catch (AWTException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent e) {
|
|
||||||
if (dump == DISPLAY_EACH_VALUE) {
|
|
||||||
// System.out.println("*********** WIIMOTE ID : "+
|
|
||||||
// e.getWiimoteId() + " **************");
|
|
||||||
/* button ONE */
|
|
||||||
if (e.isButtonOneJustPressed()) {
|
|
||||||
System.out.println("button one pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonOneHeld()) {
|
|
||||||
System.out.println("button one held");
|
|
||||||
}
|
|
||||||
if (e.isButtonOneJustReleased()) {
|
|
||||||
System.out.println("button one released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button TWO */
|
|
||||||
if (e.isButtonTwoJustPressed()) {
|
|
||||||
System.out.println("button two pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonTwoHeld()) {
|
|
||||||
System.out.println("button two held");
|
|
||||||
}
|
|
||||||
if (e.isButtonTwoJustReleased()) {
|
|
||||||
System.out.println("button two released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button A */
|
|
||||||
if (e.isButtonAJustPressed()) {
|
|
||||||
System.out.println("button A pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonAHeld()) {
|
|
||||||
System.out.println("button A held");
|
|
||||||
}
|
|
||||||
if (e.isButtonAJustReleased()) {
|
|
||||||
System.out.println("button A released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button B */
|
|
||||||
if (e.isButtonBJustPressed()) {
|
|
||||||
System.out.println("button B pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonBHeld()) {
|
|
||||||
System.out.println("button B held");
|
|
||||||
}
|
|
||||||
if (e.isButtonBJustReleased()) {
|
|
||||||
System.out.println("button B released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button LEFT */
|
|
||||||
if (e.isButtonLeftJustPressed()) {
|
|
||||||
System.out.println("button Left pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonLeftHeld()) {
|
|
||||||
System.out.println("button Left held");
|
|
||||||
}
|
|
||||||
if (e.isButtonLeftJustReleased()) {
|
|
||||||
System.out.println("button Left released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button RIGHT */
|
|
||||||
if (e.isButtonRightJustPressed()) {
|
|
||||||
System.out.println("button Right pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonRightHeld()) {
|
|
||||||
System.out.println("button Right held");
|
|
||||||
}
|
|
||||||
if (e.isButtonRightJustReleased()) {
|
|
||||||
System.out.println("button Right released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button UP */
|
|
||||||
if (e.isButtonUpJustPressed()) {
|
|
||||||
System.out.println("button UP pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonUpHeld()) {
|
|
||||||
System.out.println("button UP held");
|
|
||||||
}
|
|
||||||
if (e.isButtonUpJustReleased()) {
|
|
||||||
System.out.println("button UP released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button DOWN */
|
|
||||||
if (e.isButtonDownJustPressed()) {
|
|
||||||
System.out.println("button DOWN pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonDownHeld()) {
|
|
||||||
System.out.println("button DOWN held");
|
|
||||||
}
|
|
||||||
if (e.isButtonDownJustReleased()) {
|
|
||||||
System.out.println("button DOWN released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button MINUS */
|
|
||||||
if (e.isButtonMinusJustPressed()) {
|
|
||||||
System.out.println("button MINUS pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonMinusHeld()) {
|
|
||||||
System.out.println("button MINUS held");
|
|
||||||
}
|
|
||||||
if (e.isButtonMinusJustReleased()) {
|
|
||||||
System.out.println("button MINUS released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button PLUS */
|
|
||||||
if (e.isButtonPlusJustPressed()) {
|
|
||||||
System.out.println("button PLUS pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonPlusHeld()) {
|
|
||||||
System.out.println("button PLUS held");
|
|
||||||
}
|
|
||||||
if (e.isButtonPlusJustReleased()) {
|
|
||||||
System.out.println("button PLUS released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button HOME */
|
|
||||||
if (e.isButtonHomeJustPressed()) {
|
|
||||||
System.out.println("button HOME pressed");
|
|
||||||
}
|
|
||||||
if (e.isButtonHomeHeld()) {
|
|
||||||
System.out.println("button HOME held");
|
|
||||||
}
|
|
||||||
if (e.isButtonHomeJustReleased()) {
|
|
||||||
System.out.println("button HOME released");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get status */
|
|
||||||
if (e.isButtonUpJustPressed()) {
|
|
||||||
wiimote.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Activate rumble */
|
|
||||||
if (e.isButtonOneJustPressed()) {
|
|
||||||
System.out.println("Rumble Activated");
|
|
||||||
wiimote.activateRumble();
|
|
||||||
}
|
|
||||||
if (e.isButtonTwoJustPressed()) {
|
|
||||||
System.out.println("Rumble Deactivated");
|
|
||||||
wiimote.deactivateRumble();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Activate IR Tracking */
|
|
||||||
if (e.isButtonAJustPressed()) {
|
|
||||||
System.out.println("IR Activated");
|
|
||||||
wiimote.activateIRTRacking();
|
|
||||||
}
|
|
||||||
if (e.isButtonBJustPressed()) {
|
|
||||||
System.out.println("IR Deactivated");
|
|
||||||
wiimote.deactivateIRTRacking();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Activate Motion sensing */
|
|
||||||
if (e.isButtonPlusJustPressed()) {
|
|
||||||
System.out.println("Motion sensing Activated");
|
|
||||||
wiimote.activateMotionSensing();
|
|
||||||
}
|
|
||||||
if (e.isButtonMinusJustPressed()) {
|
|
||||||
System.out.println("Motion sensing Deactivated");
|
|
||||||
wiimote.deactivateMotionSensing();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* leave test */
|
|
||||||
if (e.isButtonHomeJustPressed()) {
|
|
||||||
System.out.println("LEAVING TEST");
|
|
||||||
wiimote.disconnect();
|
|
||||||
WiiUseApiManager.definitiveShutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (dump == DUMP) {
|
|
||||||
System.out.println(e);
|
|
||||||
/* Activate all */
|
|
||||||
if (e.isButtonAJustPressed()) {
|
|
||||||
System.out.println("IR, rumble and motion sensing Activated");
|
|
||||||
wiimote.activateIRTRacking();
|
|
||||||
wiimote.activateMotionSensing();
|
|
||||||
wiimote.activateRumble();
|
|
||||||
}
|
|
||||||
if (e.isButtonBJustPressed()) {
|
|
||||||
System.out.println("IR, rumble and motion sensing Deactivated");
|
|
||||||
wiimote.deactivateIRTRacking();
|
|
||||||
wiimote.deactivateMotionSensing();
|
|
||||||
wiimote.deactivateRumble();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* leave test */
|
|
||||||
if (e.isButtonHomeJustPressed()) {
|
|
||||||
System.out.println("LEAVING TEST");
|
|
||||||
wiimote.disconnect();
|
|
||||||
}
|
|
||||||
} else if (dump == MOVE_MOUSE) {
|
|
||||||
/* Activate IR Tracking */
|
|
||||||
if (e.isButtonOneJustPressed()) {
|
|
||||||
System.out.println("IR Activated");
|
|
||||||
wiimote.activateIRTRacking();
|
|
||||||
}
|
|
||||||
if (e.isButtonTwoJustPressed()) {
|
|
||||||
System.out.println("IR Deactivated");
|
|
||||||
wiimote.deactivateIRTRacking();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button A */
|
|
||||||
if (e.isButtonAJustPressed()) {
|
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
|
||||||
}
|
|
||||||
if (e.isButtonAJustReleased()) {
|
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button B */
|
|
||||||
if (e.isButtonBJustPressed()) {
|
|
||||||
robot.mousePress(InputEvent.BUTTON2_MASK);
|
|
||||||
}
|
|
||||||
if (e.isButtonBJustReleased()) {
|
|
||||||
robot.mouseRelease(InputEvent.BUTTON2_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* leave test */
|
|
||||||
if (e.isButtonHomeJustPressed()) {
|
|
||||||
System.out.println("LEAVING TEST");
|
|
||||||
wiimote.disconnect();
|
|
||||||
}
|
|
||||||
} else if (dump == TEST_LEDS) {
|
|
||||||
wiimote.activateMotionSensing();
|
|
||||||
if (e.isButtonUpJustPressed()) {
|
|
||||||
wiimote.setLeds(true, false, false, false);
|
|
||||||
}
|
|
||||||
if (e.isButtonDownJustPressed()) {
|
|
||||||
wiimote.setLeds(false, true, false, false);
|
|
||||||
}
|
|
||||||
if (e.isButtonLeftJustPressed()) {
|
|
||||||
wiimote.setLeds(false, false, true, false);
|
|
||||||
}
|
|
||||||
if (e.isButtonRightJustPressed()) {
|
|
||||||
wiimote.setLeds(false, false, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* leave test */
|
|
||||||
if (e.isButtonHomeJustPressed()) {
|
|
||||||
System.out.println("LEAVING TEST");
|
|
||||||
wiimote.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent e) {
|
|
||||||
if (dump == MOVE_MOUSE) {
|
|
||||||
IRSource[] list = e.getIRPoints();
|
|
||||||
if (list.length > 0) {
|
|
||||||
int x1 = (int) list[0].getX();
|
|
||||||
int y1 = (int) list[0].getY();
|
|
||||||
|
|
||||||
int mousex = (int) Math.round(((double) x1 / 1024.0) * 1280.0);
|
|
||||||
int mousey = (int) Math.round(((double) y1 / 768.0) * 1024.0);
|
|
||||||
robot.mouseMove(mousex, mousey);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent e) {
|
|
||||||
/* display motion sensing */
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent e) {
|
|
||||||
// Display status variables
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent e) {
|
|
||||||
System.out.println(" wiimote " + e.getWiimoteId()
|
|
||||||
+ "has been disconnected !!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e) {
|
|
||||||
System.out.println(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
|
|
||||||
if (wiimotes.length > 0) {
|
|
||||||
System.out.println(wiimotes[0]);
|
|
||||||
new Tests(wiimotes[0]);
|
|
||||||
} else {
|
|
||||||
System.out.println("No wiimotes found !!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// java.util.Timer timer = new java.util.Timer();
|
|
||||||
// timer.scheduleAtFixedRate(new LedsTask(), 0, 100);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.RawAcceleration;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display Acceleration in a MotionSensingEvent from an expansion.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class AccelerationExpansionEventPanel extends AccelerationPanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RawAcceleration getRawAccelerationValue(GenericEvent e) {
|
|
||||||
if (e instanceof NunchukEvent) {
|
|
||||||
return ((NunchukEvent) e).getNunchukMotionSensingEvent()
|
|
||||||
.getRawAcceleration();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import wiiusej.values.RawAcceleration;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to watch raw acceleration values from a
|
|
||||||
* MotionSensingEvent.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public abstract class AccelerationPanel extends javax.swing.JPanel implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Color xColor = Color.RED;
|
|
||||||
private Color yColor = Color.GREEN;
|
|
||||||
private Color zColor = Color.BLUE;
|
|
||||||
private Color backgroundColor = Color.WHITE;
|
|
||||||
private Color lineColor = Color.BLACK;
|
|
||||||
private ArrayList<RawAcceleration> values = new ArrayList<RawAcceleration>();
|
|
||||||
|
|
||||||
/** Creates new form AccelerationPanel */
|
|
||||||
public AccelerationPanel() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to choose the colors used by the AccelerationPanel.
|
|
||||||
*
|
|
||||||
* @param bgColor
|
|
||||||
* background color.
|
|
||||||
* @param xColor
|
|
||||||
* x color.
|
|
||||||
* @param yColor
|
|
||||||
* y color.
|
|
||||||
* @param zColor
|
|
||||||
* z color.
|
|
||||||
* @param lColor
|
|
||||||
* line color.
|
|
||||||
*/
|
|
||||||
public AccelerationPanel(Color bgColor, Color xColor, Color yColor,
|
|
||||||
Color zColor, Color lColor) {
|
|
||||||
backgroundColor = bgColor;
|
|
||||||
this.xColor = xColor;
|
|
||||||
this.yColor = yColor;
|
|
||||||
this.zColor = zColor;
|
|
||||||
lineColor = lColor;
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
// draw medium line
|
|
||||||
int yLine = getHeight() - 25;
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawLine(0, yLine, getWidth(), yLine);
|
|
||||||
|
|
||||||
RawAcceleration[] valuesArray = values.toArray(new RawAcceleration[0]);
|
|
||||||
|
|
||||||
double unit = yLine / 255.0;
|
|
||||||
int previousX = 0;
|
|
||||||
int previousY = 0;
|
|
||||||
int previousZ = 0;
|
|
||||||
// draw curves
|
|
||||||
for (int i = 0; i < valuesArray.length && i < getWidth(); i++) {
|
|
||||||
RawAcceleration acceleration = valuesArray[i];
|
|
||||||
// draw X
|
|
||||||
g2.setPaint(xColor);
|
|
||||||
int yDelta = (int) Math.round(unit * acceleration.getX());
|
|
||||||
int y = -1 * yDelta + yLine;
|
|
||||||
g2.drawLine(i - 1, previousX, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousX = y;
|
|
||||||
// draw Y
|
|
||||||
g2.setPaint(yColor);
|
|
||||||
yDelta = (int) Math.round(unit * acceleration.getY());
|
|
||||||
y = -1 * yDelta + yLine;
|
|
||||||
g2.drawLine(i - 1, previousY, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousY = y;
|
|
||||||
// draw Z
|
|
||||||
g2.setPaint(zColor);
|
|
||||||
yDelta = (int) Math.round(unit * acceleration.getZ());
|
|
||||||
y = -1 * yDelta + yLine;
|
|
||||||
g2.drawLine(i - 1, previousZ, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousZ = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw legend
|
|
||||||
g2.setPaint(xColor);
|
|
||||||
g2.drawLine(5, getHeight() - 10, 25, getHeight() - 10);
|
|
||||||
g2.setPaint(yColor);
|
|
||||||
g2.drawLine(60, getHeight() - 10, 80, getHeight() - 10);
|
|
||||||
g2.setPaint(zColor);
|
|
||||||
g2.drawLine(120, getHeight() - 10, 140, getHeight() - 10);
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawString("X", 30, getHeight() - 5);
|
|
||||||
g2.drawString("Y", 85, getHeight() - 5);
|
|
||||||
g2.drawString("Z", 145, getHeight() - 5);
|
|
||||||
g2.drawString("0", 2, yLine - 5);
|
|
||||||
g2.drawString("255", 2, 15);
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// Clear points.
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
private void draw(GenericEvent arg0) {
|
|
||||||
if (values.size() >= getWidth()) {
|
|
||||||
// if there are as many values as pixels in the width
|
|
||||||
// clear points
|
|
||||||
values.clear();
|
|
||||||
}
|
|
||||||
RawAcceleration rawAcceleration = getRawAccelerationValue(arg0);
|
|
||||||
if (rawAcceleration != null)
|
|
||||||
values.add(rawAcceleration);
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract RawAcceleration getRawAccelerationValue(GenericEvent e);
|
|
||||||
|
|
||||||
public Color getBackgroundColor() {
|
|
||||||
return backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getXColor() {
|
|
||||||
return xColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getYColor() {
|
|
||||||
return yColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getZColor() {
|
|
||||||
return zColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundColor(Color backgroundColor) {
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineColor(Color lineColor) {
|
|
||||||
this.lineColor = lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXColor(Color xColor) {
|
|
||||||
this.xColor = xColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYColor(Color yColor) {
|
|
||||||
this.yColor = yColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setZColor(Color zColor) {
|
|
||||||
this.zColor = zColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.RawAcceleration;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display Acceleration in a MotionSensingEvent from a wiimote.
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class AccelerationWiimoteEventPanel extends AccelerationPanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RawAcceleration getRawAccelerationValue(GenericEvent e) {
|
|
||||||
if (e instanceof MotionSensingEvent) {
|
|
||||||
return ((MotionSensingEvent) e).getRawAcceleration();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,382 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Shape;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to see what buttons are pressed on the wiimote. It
|
|
||||||
* displays the result of last ButtonsEvent.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class ButtonsEventPanel extends javax.swing.JPanel implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Image wiimoteImage;// image for double buffering
|
|
||||||
private WiimoteButtonsEvent buttons;
|
|
||||||
private Color pressedColor = Color.RED;
|
|
||||||
private Color heldColor = Color.ORANGE;
|
|
||||||
private Color releasedColor = Color.YELLOW;
|
|
||||||
private Shape shape = new java.awt.geom.Ellipse2D.Double(0, 0, 13, 13);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Red : button just pressed. Orange : button held.
|
|
||||||
* Yellow : button just released.
|
|
||||||
*/
|
|
||||||
public ButtonsEventPanel() {
|
|
||||||
Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
|
|
||||||
java.net.URL url = ButtonsEventPanel.class
|
|
||||||
.getResource("/img/wiimote.png");
|
|
||||||
wiimoteImage = toolkit.createImage(url);
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to set colors and shape used.
|
|
||||||
*
|
|
||||||
* @param pressColor
|
|
||||||
* color of a button just pressed.
|
|
||||||
* @param hColor
|
|
||||||
* color of a button held.
|
|
||||||
* @param relColor
|
|
||||||
* color of a button just released.
|
|
||||||
* @param sh
|
|
||||||
* shape draw on the buttons.
|
|
||||||
*/
|
|
||||||
public ButtonsEventPanel(Color pressColor, Color hColor, Color relColor,
|
|
||||||
Shape sh) {
|
|
||||||
pressedColor = pressColor;
|
|
||||||
heldColor = hColor;
|
|
||||||
releasedColor = relColor;
|
|
||||||
shape = sh;
|
|
||||||
Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
|
|
||||||
wiimoteImage = toolkit.createImage("img\\wiimote.png");
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
// offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
// draw buttons pushed
|
|
||||||
g2.drawImage(wiimoteImage, 0, 0, this);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
|
|
||||||
if (buttons != null) {
|
|
||||||
/* button ONE */
|
|
||||||
if (buttons.isButtonOneJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 53, 353);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonOneHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 53, 353);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonOneJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 53, 353);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button TWO */
|
|
||||||
if (buttons.isButtonTwoJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 53, 395);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonTwoHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 53, 395);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonTwoJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 53, 395);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button A */
|
|
||||||
if (buttons.isButtonAJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 53, 150);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonAHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 53, 150);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonAJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 53, 150);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button B */
|
|
||||||
if (buttons.isButtonBJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 16, 149);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonBHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 16, 149);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonBJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 16, 149);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button LEFT */
|
|
||||||
if (buttons.isButtonLeftJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 33, 77);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonLeftHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 33, 77);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonLeftJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 33, 77);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button RIGHT */
|
|
||||||
if (buttons.isButtonRightJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 73, 77);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonRightHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 73, 77);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonRightJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 73, 77);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button UP */
|
|
||||||
if (buttons.isButtonUpJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 54, 60);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonUpHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 54, 60);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonUpJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 54, 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button DOWN */
|
|
||||||
if (buttons.isButtonDownJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 54, 97);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonDownHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 54, 97);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonDownJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 54, 97);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button MINUS */
|
|
||||||
if (buttons.isButtonMinusJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 20, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonMinusHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 20, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonMinusJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 20, 230);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button PLUS */
|
|
||||||
if (buttons.isButtonPlusJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 86, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonPlusHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 86, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonPlusJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 86, 230);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button HOME */
|
|
||||||
if (buttons.isButtonHomeJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 53, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonHomeHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 53, 230);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonHomeJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 53, 230);
|
|
||||||
}
|
|
||||||
|
|
||||||
buttons = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to factorize code.
|
|
||||||
*
|
|
||||||
* @param g2
|
|
||||||
* where to draw a shape.
|
|
||||||
* @param col
|
|
||||||
* color to use.
|
|
||||||
* @param x
|
|
||||||
* x coordinates.
|
|
||||||
* @param y
|
|
||||||
* y coordinates.
|
|
||||||
*/
|
|
||||||
private void drawFunction(Graphics2D g2, Color col, int x, int y) {
|
|
||||||
g2.setPaint(col);
|
|
||||||
g2.translate(x, y);
|
|
||||||
g2.draw(shape);
|
|
||||||
g2.fill(shape);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
setSize(wiimoteImage.getWidth(this), wiimoteImage.getHeight(this));
|
|
||||||
buttons = arg0;
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
clearView();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getHeldColor() {
|
|
||||||
return heldColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getPressedColor() {
|
|
||||||
return pressedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getReleasedColor() {
|
|
||||||
return releasedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape getShape() {
|
|
||||||
return shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeldColor(Color heldColor) {
|
|
||||||
this.heldColor = heldColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPressedColor(Color pressedColor) {
|
|
||||||
this.pressedColor = pressedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleasedColor(Color releasedColor) {
|
|
||||||
this.releasedColor = releasedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShape(Shape shape) {
|
|
||||||
this.shape = shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
buttons = null;
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,501 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Shape;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ClassicControllerButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ClassicControllerEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.JoystickEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to display what happens on the classic controller.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class ClassicControllerButtonsEventPanel extends javax.swing.JPanel implements WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Image wiimoteImage;// image for double buffering
|
|
||||||
private ClassicControllerEvent event;
|
|
||||||
private Color pressedColor = Color.RED;
|
|
||||||
private Color heldColor = Color.ORANGE;
|
|
||||||
private Color releasedColor = Color.YELLOW;
|
|
||||||
private Color joystickColor = Color.PINK;
|
|
||||||
private Color shoulderColor = Color.BLUE;
|
|
||||||
private Shape shapeJoystick = new java.awt.geom.Ellipse2D.Double(0, 0, 15, 15);
|
|
||||||
private Shape shapeButton = new java.awt.geom.Ellipse2D.Double(0, 0, 20, 20);
|
|
||||||
private static int xAmplitude = 20;
|
|
||||||
private static int yAmplitude = 20;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Red : button just pressed. Orange : button held.
|
|
||||||
* Yellow : button just released.
|
|
||||||
*/
|
|
||||||
public ClassicControllerButtonsEventPanel() {
|
|
||||||
Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
|
|
||||||
java.net.URL url = ButtonsEventPanel.class.getResource("/img/classiccontroller.png");
|
|
||||||
wiimoteImage = toolkit.createImage(url);
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to set colors and shape used.
|
|
||||||
*
|
|
||||||
* @param pressColor
|
|
||||||
* color of a button just pressed.
|
|
||||||
* @param hColor
|
|
||||||
* color of a button held.
|
|
||||||
* @param relColor
|
|
||||||
* color of a button just released.
|
|
||||||
* @param jsColor
|
|
||||||
* color of the joysticks.
|
|
||||||
* @param shouldColor
|
|
||||||
* color of the shoulders.
|
|
||||||
* @param js
|
|
||||||
* shape drawn on the joysticks.
|
|
||||||
* @param sh
|
|
||||||
* shape drawn on the buttons.
|
|
||||||
*/
|
|
||||||
public ClassicControllerButtonsEventPanel(Color pressColor, Color hColor, Color relColor,
|
|
||||||
Color jsColor, Color shouldColor, Shape js, Shape sh) {
|
|
||||||
pressedColor = pressColor;
|
|
||||||
heldColor = hColor;
|
|
||||||
releasedColor = relColor;
|
|
||||||
shapeButton = sh;
|
|
||||||
shapeJoystick = js;
|
|
||||||
joystickColor = jsColor;
|
|
||||||
shoulderColor = shouldColor;
|
|
||||||
Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
|
|
||||||
wiimoteImage = toolkit.createImage("img\\wiimote.png");
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 400, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 300, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
// offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
//draw classic controller
|
|
||||||
g2.drawImage(wiimoteImage, 0, 0, this);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
|
|
||||||
if (event != null) {
|
|
||||||
// draw buttons pushed
|
|
||||||
ClassicControllerButtonsEvent buttons = event.getButtonsEvent();
|
|
||||||
|
|
||||||
/* button A */
|
|
||||||
if (buttons.isButtonAJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 304, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonAHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 304, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonAJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 304, 76, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button B */
|
|
||||||
if (buttons.isButtonBJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 269, 98, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonBHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 269, 98, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonBJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 269, 98, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Down */
|
|
||||||
if (buttons.isButtonDownJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 60, 97, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonDownHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 60, 97, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonDownJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 60, 97, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button FullLeft */
|
|
||||||
if (buttons.isButtonFullLeftJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 55, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonFullLeftHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 55, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonFullLeftJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 55, 4, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button FullRight */
|
|
||||||
if (buttons.isButtonFullRightJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 276, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonFullRightHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 276, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonFullRightJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 276, 4, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Home */
|
|
||||||
if (buttons.isButtonHomeJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 166, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonHomeHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 166, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonHomeJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 166, 76, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Left */
|
|
||||||
if (buttons.isButtonLeftJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 34, 75, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonLeftHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 34, 75, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonLeftJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 34, 75, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Minus */
|
|
||||||
if (buttons.isButtonMinusJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 140, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonMinusHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 140, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonMinusJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 140, 76, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Plus */
|
|
||||||
if (buttons.isButtonPlusJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 191, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonPlusHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 191, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonPlusJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 191, 76, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Right */
|
|
||||||
if (buttons.isButtonRightJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 86, 75, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonRightHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 86, 75, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonRightJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 86, 353, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Up */
|
|
||||||
if (buttons.isButtonUpJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 60, 50, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonUpHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 60, 50, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonUpJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 60, 50, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button X */
|
|
||||||
if (buttons.isButtonXJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 271, 53, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonXHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 271, 53, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonXJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 271, 53, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button Y */
|
|
||||||
if (buttons.isButtonYJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 237, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonYHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 237, 76, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonYJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 237, 76, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button ZL */
|
|
||||||
if (buttons.isButtonZLJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 123, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonZLHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 123, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonZLJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 123, 4, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* button ZR */
|
|
||||||
if (buttons.isButtonZRJustPressed()) {
|
|
||||||
drawFunction(g2, pressedColor, 208, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonZRHeld()) {
|
|
||||||
drawFunction(g2, heldColor, 208, 4, shapeButton);
|
|
||||||
}
|
|
||||||
if (buttons.isButtonZRJustReleased()) {
|
|
||||||
drawFunction(g2, releasedColor, 208, 4, shapeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
//joysticks
|
|
||||||
int halfWidth = (int) Math.round(shapeJoystick.getBounds().getWidth() / 2);
|
|
||||||
int halfHeight = (int) Math.round(shapeJoystick.getBounds().getHeight() / 2);
|
|
||||||
|
|
||||||
// left joystick
|
|
||||||
JoystickEvent jl = event.getClassicControllerLeftJoystickEvent();
|
|
||||||
int xCenter1 = 121;
|
|
||||||
int yCenter1 = 125;
|
|
||||||
|
|
||||||
double xAng1 = Math.sin(jl.getAngle() * Math.PI / 180.0) * jl.getMagnitude();
|
|
||||||
double yAng1 = Math.cos(jl.getAngle() * Math.PI / 180.0) * jl.getMagnitude();
|
|
||||||
|
|
||||||
int xShift1 = (int) Math.round(xAng1 * xAmplitude);
|
|
||||||
int yShift1 = (int) Math.round(yAng1 * yAmplitude);
|
|
||||||
int x1 = xCenter1 + xShift1 - halfWidth;
|
|
||||||
int y1 = yCenter1 - yShift1 - halfHeight;
|
|
||||||
// draw shape
|
|
||||||
drawFunction(g2, joystickColor, x1, y1, shapeJoystick);
|
|
||||||
|
|
||||||
//Right joystick
|
|
||||||
JoystickEvent jr = event.getClassicControllerRightJoystickEvent();
|
|
||||||
int xCenter2 = 213;
|
|
||||||
int yCenter2 = 125;
|
|
||||||
|
|
||||||
double xAng2 = Math.sin(jr.getAngle() * Math.PI / 180.0) * jr.getMagnitude();
|
|
||||||
double yAng2 = Math.cos(jr.getAngle() * Math.PI / 180.0) * jr.getMagnitude();
|
|
||||||
|
|
||||||
int xShift2 = (int) Math.round(xAng2 * xAmplitude);
|
|
||||||
int yShift2 = (int) Math.round(yAng2 * yAmplitude);
|
|
||||||
int x2 = xCenter2 + xShift2 - halfWidth;
|
|
||||||
int y2 = yCenter2 - yShift2 - halfHeight;
|
|
||||||
// draw shape
|
|
||||||
drawFunction(g2, joystickColor, x2, y2, shapeJoystick);
|
|
||||||
|
|
||||||
event = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to factorize code.
|
|
||||||
*
|
|
||||||
* @param g2
|
|
||||||
* where to draw a shape.
|
|
||||||
* @param col
|
|
||||||
* color to use.
|
|
||||||
* @param x
|
|
||||||
* x coordinates.
|
|
||||||
* @param y
|
|
||||||
* y coordinates.
|
|
||||||
* @param sh
|
|
||||||
* shape to draw.
|
|
||||||
*/
|
|
||||||
private void drawFunction(Graphics2D g2, Color col, int x, int y, Shape sh) {
|
|
||||||
g2.setPaint(col);
|
|
||||||
g2.translate(x, y);
|
|
||||||
g2.draw(sh);
|
|
||||||
g2.fill(sh);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width || mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
if (arg0 instanceof ClassicControllerEvent) {
|
|
||||||
event = (ClassicControllerEvent) arg0;
|
|
||||||
}
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent arg0) {
|
|
||||||
clearView();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getHeldColor() {
|
|
||||||
return heldColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getJoystickColor() {
|
|
||||||
return joystickColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getPressedColor() {
|
|
||||||
return pressedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getReleasedColor() {
|
|
||||||
return releasedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getShoulderColor() {
|
|
||||||
return shoulderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape getShapeButton() {
|
|
||||||
return shapeButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape getShapeJoystick() {
|
|
||||||
return shapeJoystick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeldColor(Color heldColor) {
|
|
||||||
this.heldColor = heldColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoystickColor(Color joystickColor) {
|
|
||||||
this.joystickColor = joystickColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPressedColor(Color pressedColor) {
|
|
||||||
this.pressedColor = pressedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleasedColor(Color releasedColor) {
|
|
||||||
this.releasedColor = releasedColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShoulderColor(Color shoulderColor) {
|
|
||||||
this.shoulderColor = shoulderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShapeButton(Shape shapeButton) {
|
|
||||||
this.shapeButton = shapeButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShapeJoystick(Shape shapeJoystick) {
|
|
||||||
this.shapeJoystick = shapeJoystick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
event = null;
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.GForce;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display GForce in a MotionSensingEvent from an expansion.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class GForceExpansionEventPanel extends GForcePanel{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GForce getGForceValue(GenericEvent e) {
|
|
||||||
if (e instanceof NunchukEvent){
|
|
||||||
return ((NunchukEvent)e).getNunchukMotionSensingEvent().getGforce();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,304 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import wiiusej.values.GForce;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to watch gravity force values from a MotionSensingEvent.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public abstract class GForcePanel extends javax.swing.JPanel implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Color xColor = Color.RED;
|
|
||||||
private Color yColor = Color.GREEN;
|
|
||||||
private Color zColor = Color.BLUE;
|
|
||||||
private Color backgroundColor = Color.WHITE;
|
|
||||||
private Color lineColor = Color.BLACK;
|
|
||||||
private ArrayList<GForce> values = new ArrayList<GForce>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor of the AccelerationPanel.
|
|
||||||
*/
|
|
||||||
public GForcePanel() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to choose the colors used by the AccelerationPanel.
|
|
||||||
*
|
|
||||||
* @param bgColor
|
|
||||||
* background color.
|
|
||||||
* @param xxColor
|
|
||||||
* color of the acceleration on X axis.
|
|
||||||
* @param yyColor
|
|
||||||
* color of the acceleration on Y axis.
|
|
||||||
* @param zzColor
|
|
||||||
* color of the acceleration on Z axis.
|
|
||||||
* @param lColor
|
|
||||||
* line color.
|
|
||||||
*/
|
|
||||||
public GForcePanel(Color bgColor, Color xxColor, Color yyColor,
|
|
||||||
Color zzColor, Color lColor) {
|
|
||||||
backgroundColor = bgColor;
|
|
||||||
xColor = xxColor;
|
|
||||||
yColor = yyColor;
|
|
||||||
zColor = zzColor;
|
|
||||||
lineColor = lColor;
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
// draw medium line
|
|
||||||
double yMiddleFloat = getHeight() / 2.0;
|
|
||||||
int yMiddle = (int) Math.round(yMiddleFloat);
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawLine(0, yMiddle, getWidth(), yMiddle);
|
|
||||||
|
|
||||||
GForce[] valuesArray = values.toArray(new GForce[0]);
|
|
||||||
double unit = yMiddleFloat / 5.0;
|
|
||||||
int previousX = 0;
|
|
||||||
int previousY = 0;
|
|
||||||
int previousZ = 0;
|
|
||||||
// draw curves
|
|
||||||
for (int i = 0; i < valuesArray.length && i < getWidth(); i++) {
|
|
||||||
GForce gforce = valuesArray[i];
|
|
||||||
// draw X
|
|
||||||
g2.setPaint(xColor);
|
|
||||||
int yDelta = (int) Math.round(unit * gforce.getX());
|
|
||||||
int y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousX, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousX = y;
|
|
||||||
// draw Y
|
|
||||||
g2.setPaint(yColor);
|
|
||||||
yDelta = (int) Math.round(unit * gforce.getY());
|
|
||||||
y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousY, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousY = y;
|
|
||||||
// draw Z
|
|
||||||
g2.setPaint(zColor);
|
|
||||||
yDelta = (int) Math.round(unit * gforce.getZ());
|
|
||||||
y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousZ, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousZ = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw legend
|
|
||||||
g2.setPaint(xColor);
|
|
||||||
g2.drawLine(5, getHeight() - 10, 25, getHeight() - 10);
|
|
||||||
g2.setPaint(yColor);
|
|
||||||
g2.drawLine(60, getHeight() - 10, 80, getHeight() - 10);
|
|
||||||
g2.setPaint(zColor);
|
|
||||||
g2.drawLine(120, getHeight() - 10, 140, getHeight() - 10);
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawString("X", 30, getHeight() - 5);
|
|
||||||
g2.drawString("Y", 85, getHeight() - 5);
|
|
||||||
g2.drawString("Z", 145, getHeight() - 5);
|
|
||||||
g2.drawString("0", 2, yMiddle - 5);
|
|
||||||
g2.drawString("5", 2, 10);
|
|
||||||
g2.drawString("-5", 2, getHeight() - 15);
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// Clear points.
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
private void draw(GenericEvent arg0) {
|
|
||||||
if (values.size() >= getWidth()) {
|
|
||||||
// if there are as many values as pixels in the width
|
|
||||||
// clear points
|
|
||||||
values.clear();
|
|
||||||
}
|
|
||||||
GForce gforce = getGForceValue(arg0);
|
|
||||||
if (gforce != null)
|
|
||||||
values.add(gforce);
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract GForce getGForceValue(GenericEvent e);
|
|
||||||
|
|
||||||
public Color getBackgroundColor() {
|
|
||||||
return backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getXColor() {
|
|
||||||
return xColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getYColor() {
|
|
||||||
return yColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getZColor() {
|
|
||||||
return zColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundColor(Color backgroundColor) {
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineColor(Color lineColor) {
|
|
||||||
this.lineColor = lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXColor(Color xColor) {
|
|
||||||
this.xColor = xColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYColor(Color yColor) {
|
|
||||||
this.yColor = yColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setZColor(Color zColor) {
|
|
||||||
this.zColor = zColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.GForce;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display GForce in a MotionSensingEvent from a wiimote.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class GForceWiimoteEventPanel extends GForcePanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GForce getGForceValue(GenericEvent e) {
|
|
||||||
if (e instanceof MotionSensingEvent) {
|
|
||||||
return ((MotionSensingEvent) e).getGforce();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.GuitarHeroButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to display what happens on the buttons of the
|
|
||||||
* Guitar Hero 3 controller.
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class GuitarHero3ButtonsEventPanel extends javax.swing.JPanel implements WiimoteListener {
|
|
||||||
|
|
||||||
/** Creates new form GuitarHero3ButtonsEventPanel */
|
|
||||||
public GuitarHero3ButtonsEventPanel() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
|
||||||
* initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
|
||||||
* always regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
leftPanel = new javax.swing.JPanel();
|
|
||||||
plusButton = new javax.swing.JToggleButton();
|
|
||||||
minusButton = new javax.swing.JToggleButton();
|
|
||||||
strumPanel = new javax.swing.JPanel();
|
|
||||||
strumUpButton = new javax.swing.JToggleButton();
|
|
||||||
strumDownButton = new javax.swing.JToggleButton();
|
|
||||||
RightPanel = new javax.swing.JPanel();
|
|
||||||
coloredButtonsPanel = new javax.swing.JPanel();
|
|
||||||
orangeButton = new javax.swing.JToggleButton();
|
|
||||||
blueButton = new javax.swing.JToggleButton();
|
|
||||||
yellowButton = new javax.swing.JToggleButton();
|
|
||||||
redButton = new javax.swing.JToggleButton();
|
|
||||||
greenButton = new javax.swing.JToggleButton();
|
|
||||||
|
|
||||||
setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
|
|
||||||
|
|
||||||
leftPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
leftPanel.setLayout(new javax.swing.BoxLayout(leftPanel, javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
|
|
||||||
plusButton.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
plusButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
plusButton.setText("+");
|
|
||||||
leftPanel.add(plusButton);
|
|
||||||
|
|
||||||
minusButton.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
minusButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
minusButton.setText("-");
|
|
||||||
leftPanel.add(minusButton);
|
|
||||||
|
|
||||||
strumPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
strumPanel.setLayout(new javax.swing.BoxLayout(strumPanel, javax.swing.BoxLayout.Y_AXIS));
|
|
||||||
|
|
||||||
strumUpButton.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
strumUpButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
strumUpButton.setText("Strum UP");
|
|
||||||
strumPanel.add(strumUpButton);
|
|
||||||
|
|
||||||
strumDownButton.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
strumDownButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
strumDownButton.setText("Strum DOWN");
|
|
||||||
strumPanel.add(strumDownButton);
|
|
||||||
|
|
||||||
leftPanel.add(strumPanel);
|
|
||||||
|
|
||||||
add(leftPanel);
|
|
||||||
|
|
||||||
RightPanel.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
RightPanel.setLayout(new javax.swing.BoxLayout(RightPanel, javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
|
|
||||||
coloredButtonsPanel.setLayout(new javax.swing.BoxLayout(coloredButtonsPanel, javax.swing.BoxLayout.LINE_AXIS));
|
|
||||||
|
|
||||||
orangeButton.setBackground(new java.awt.Color(255, 153, 0));
|
|
||||||
orangeButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
orangeButton.setText("O");
|
|
||||||
coloredButtonsPanel.add(orangeButton);
|
|
||||||
|
|
||||||
blueButton.setBackground(new java.awt.Color(0, 0, 204));
|
|
||||||
blueButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
blueButton.setText("O");
|
|
||||||
coloredButtonsPanel.add(blueButton);
|
|
||||||
|
|
||||||
yellowButton.setBackground(new java.awt.Color(255, 255, 0));
|
|
||||||
yellowButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
yellowButton.setText("O");
|
|
||||||
coloredButtonsPanel.add(yellowButton);
|
|
||||||
|
|
||||||
redButton.setBackground(new java.awt.Color(255, 0, 0));
|
|
||||||
redButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
redButton.setText("O");
|
|
||||||
coloredButtonsPanel.add(redButton);
|
|
||||||
|
|
||||||
greenButton.setBackground(new java.awt.Color(51, 255, 0));
|
|
||||||
greenButton.setFont(new java.awt.Font("Arial", 1, 24));
|
|
||||||
greenButton.setText("O");
|
|
||||||
coloredButtonsPanel.add(greenButton);
|
|
||||||
|
|
||||||
RightPanel.add(coloredButtonsPanel);
|
|
||||||
|
|
||||||
add(RightPanel);
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
if (arg0 instanceof GuitarHeroEvent) {
|
|
||||||
GuitarHeroEvent guitar = (GuitarHeroEvent) arg0;
|
|
||||||
GuitarHeroButtonsEvent buttons = guitar.getButtonsEvent();
|
|
||||||
|
|
||||||
//orange button
|
|
||||||
if (buttons.isButtonOrangeJustPressed()) {
|
|
||||||
orangeButton.setSelected(true);
|
|
||||||
orangeButton.setText("X");
|
|
||||||
} else if (buttons.isButtonOrangeJustReleased()) {
|
|
||||||
orangeButton.setSelected(false);
|
|
||||||
orangeButton.setText("O");
|
|
||||||
}
|
|
||||||
|
|
||||||
//blue button
|
|
||||||
if (buttons.isButtonBlueJustPressed()) {
|
|
||||||
blueButton.setSelected(true);
|
|
||||||
blueButton.setText("X");
|
|
||||||
} else if (buttons.isButtonBlueJustReleased()) {
|
|
||||||
blueButton.setSelected(false);
|
|
||||||
blueButton.setText("O");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Yellow button
|
|
||||||
if (buttons.isButtonYellowJustPressed()) {
|
|
||||||
yellowButton.setSelected(true);
|
|
||||||
yellowButton.setText("X");
|
|
||||||
} else if (buttons.isButtonYellowJustReleased()) {
|
|
||||||
yellowButton.setSelected(false);
|
|
||||||
yellowButton.setText("O");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Red button
|
|
||||||
if (buttons.isButtonRedJustPressed()) {
|
|
||||||
redButton.setSelected(true);
|
|
||||||
redButton.setText("X");
|
|
||||||
} else if (buttons.isButtonRedJustReleased()) {
|
|
||||||
redButton.setSelected(false);
|
|
||||||
redButton.setText("O");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Green button
|
|
||||||
if (buttons.isButtonGreenJustPressed()) {
|
|
||||||
greenButton.setSelected(true);
|
|
||||||
greenButton.setText("X");
|
|
||||||
} else if (buttons.isButtonGreenJustReleased()) {
|
|
||||||
greenButton.setSelected(false);
|
|
||||||
greenButton.setText("O");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Plus button
|
|
||||||
if (buttons.isButtonPlusJustPressed()) {
|
|
||||||
plusButton.setSelected(true);
|
|
||||||
} else if (buttons.isButtonPlusJustReleased()) {
|
|
||||||
plusButton.setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Minus button
|
|
||||||
if (buttons.isButtonMinusJustPressed()) {
|
|
||||||
minusButton.setSelected(true);
|
|
||||||
} else if (buttons.isButtonMinusJustReleased()) {
|
|
||||||
minusButton.setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Strum up button
|
|
||||||
if (buttons.isButtonStrumUpJustPressed()) {
|
|
||||||
strumUpButton.setSelected(true);
|
|
||||||
} else if (buttons.isButtonStrumUpJustReleased()) {
|
|
||||||
strumUpButton.setSelected(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Strum down button
|
|
||||||
if (buttons.isButtonStrumDownJustPressed()) {
|
|
||||||
strumDownButton.setSelected(true);
|
|
||||||
} else if (buttons.isButtonStrumDownJustReleased()) {
|
|
||||||
strumDownButton.setSelected(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent arg0) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JPanel RightPanel;
|
|
||||||
private javax.swing.JToggleButton blueButton;
|
|
||||||
private javax.swing.JPanel coloredButtonsPanel;
|
|
||||||
private javax.swing.JToggleButton greenButton;
|
|
||||||
private javax.swing.JPanel leftPanel;
|
|
||||||
private javax.swing.JToggleButton minusButton;
|
|
||||||
private javax.swing.JToggleButton orangeButton;
|
|
||||||
private javax.swing.JToggleButton plusButton;
|
|
||||||
private javax.swing.JToggleButton redButton;
|
|
||||||
private javax.swing.JToggleButton strumDownButton;
|
|
||||||
private javax.swing.JPanel strumPanel;
|
|
||||||
private javax.swing.JToggleButton strumUpButton;
|
|
||||||
private javax.swing.JToggleButton yellowButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.JoystickEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display Guitar Hero 3 controller joystick events.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class GuitarHeroJoystickEventPanel extends JoystickEventPanel{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JoystickEvent getJoystickEvent(ExpansionEvent e) {
|
|
||||||
if (e instanceof GuitarHeroEvent){
|
|
||||||
return ((GuitarHeroEvent)e).getGuitarHeroJoystickEvent();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,275 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Shape;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to see what the IR camera of the wiimote sees.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class IRPanel extends javax.swing.JPanel implements WiimoteListener {
|
|
||||||
|
|
||||||
private static int MAX_NB_POINTS = 4;
|
|
||||||
private Color color = Color.YELLOW;
|
|
||||||
private Color backgroundColor = Color.BLACK;
|
|
||||||
private Color borderColor = Color.BLUE;
|
|
||||||
private Shape shape;
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private int[] xCoordinates;
|
|
||||||
private int[] yCoordinates;
|
|
||||||
private int nbPoints = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor for IR Panel. Background color : black. IR sources
|
|
||||||
* color : yellow. Border color of IR sources : blue. Shape of the IR
|
|
||||||
* sources : circle with a diameter of 10.
|
|
||||||
*/
|
|
||||||
public IRPanel() {
|
|
||||||
shape = new java.awt.geom.Ellipse2D.Double(0, 0, 10, 10);
|
|
||||||
initArrays();
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to parameterize the IR panel.
|
|
||||||
*
|
|
||||||
* @param bgColor
|
|
||||||
* color.
|
|
||||||
* @param ptColor
|
|
||||||
* IR sources color.
|
|
||||||
* @param bdColor
|
|
||||||
* border color of IR sources.
|
|
||||||
* @param sh
|
|
||||||
* Shape of the IR sources.
|
|
||||||
*/
|
|
||||||
public IRPanel(Color bgColor, Color ptColor, Color bdColor, Shape sh) {
|
|
||||||
backgroundColor = bgColor;
|
|
||||||
color = ptColor;
|
|
||||||
borderColor = bdColor;
|
|
||||||
shape = sh;
|
|
||||||
initArrays();
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initArrays() {
|
|
||||||
xCoordinates = new int[MAX_NB_POINTS];
|
|
||||||
yCoordinates = new int[MAX_NB_POINTS];
|
|
||||||
for (int i = 0; i < MAX_NB_POINTS; i++) {
|
|
||||||
xCoordinates[i] = -1;
|
|
||||||
yCoordinates[i] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
// draw points
|
|
||||||
int i = 0;
|
|
||||||
while (i < nbPoints) {
|
|
||||||
double x = xCoordinates[i];
|
|
||||||
double y = yCoordinates[i];
|
|
||||||
|
|
||||||
long xx = getWidth() - Math.round((double) getWidth() * x / 1024.0);
|
|
||||||
long yy = getHeight()
|
|
||||||
- Math.round((double) getHeight() * y / 768.0);
|
|
||||||
g2.translate(xx, yy);
|
|
||||||
|
|
||||||
g2.setPaint(borderColor);
|
|
||||||
g2.draw(shape);
|
|
||||||
g2.setPaint(color);
|
|
||||||
g2.fill(shape);
|
|
||||||
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// transfer points
|
|
||||||
wiiusej.values.IRSource[] points = arg0.getIRPoints();
|
|
||||||
nbPoints = points.length;
|
|
||||||
for (int i = 0; i < points.length; i++) {
|
|
||||||
xCoordinates[i] = (int) points[i].getRx();
|
|
||||||
yCoordinates[i] = (int) points[i].getRy();
|
|
||||||
}
|
|
||||||
for (int i = points.length; i < MAX_NB_POINTS; i++) {
|
|
||||||
xCoordinates[i] = -1;
|
|
||||||
yCoordinates[i] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// redraw panel
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// clear previous points
|
|
||||||
for (int i = 0; i < MAX_NB_POINTS; i++) {
|
|
||||||
xCoordinates[i] = -1;
|
|
||||||
yCoordinates[i] = -1;
|
|
||||||
}
|
|
||||||
// redraw panel
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent e) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getBackgroundColor() {
|
|
||||||
return backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape getShape() {
|
|
||||||
return shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundColor(Color backgroundColor) {
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShape(Shape shape) {
|
|
||||||
this.shape = shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
initArrays();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Shape;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.JoystickEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display joystick events.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public abstract class JoystickEventPanel extends javax.swing.JPanel implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Color backgroundColor = Color.BLACK;
|
|
||||||
private Color borderColor = Color.RED;
|
|
||||||
private Color pointColor = Color.RED;
|
|
||||||
private Shape shape = new java.awt.geom.Ellipse2D.Double(0, 0, 30, 30);
|
|
||||||
private JoystickEvent lastJoystickEvent = null;
|
|
||||||
|
|
||||||
/** Creates new form JoystickPanel */
|
|
||||||
public JoystickEventPanel() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to choose the colors used by the JoystickPanel.
|
|
||||||
*
|
|
||||||
* @param bgColor
|
|
||||||
* background color.
|
|
||||||
* @param pColor
|
|
||||||
* point color.
|
|
||||||
* @param bdColor
|
|
||||||
* border color for the shape.
|
|
||||||
* @param sh
|
|
||||||
* shape of what is drawn.
|
|
||||||
*/
|
|
||||||
public JoystickEventPanel(Color bgColor, Color pColor, Color bdColor,
|
|
||||||
Shape sh) {
|
|
||||||
backgroundColor = bgColor;
|
|
||||||
pointColor = pColor;
|
|
||||||
shape = sh;
|
|
||||||
borderColor = bdColor;
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
|
|
||||||
// compute center
|
|
||||||
int xCenter = (int) Math.round(d.getWidth() / 2.0);
|
|
||||||
int yCenter = (int) Math.round(d.getHeight() / 2.0);
|
|
||||||
|
|
||||||
// compute coordinates
|
|
||||||
if (lastJoystickEvent != null) {
|
|
||||||
double xAng = Math.sin(lastJoystickEvent.getAngle() * Math.PI
|
|
||||||
/ 180.0)
|
|
||||||
* lastJoystickEvent.getMagnitude();
|
|
||||||
double yAng = Math.cos(lastJoystickEvent.getAngle() * Math.PI
|
|
||||||
/ 180.0)
|
|
||||||
* lastJoystickEvent.getMagnitude();
|
|
||||||
int halfWidth = (int) Math.round(shape.getBounds().getWidth() / 2);
|
|
||||||
int halHeight = (int) Math.round(shape.getBounds().getHeight() / 2);
|
|
||||||
int xAmplitude = (int) Math.round(xCenter - shape.getBounds().getWidth());
|
|
||||||
int yAmplitude = (int) Math.round(xCenter - shape.getBounds().getHeight());
|
|
||||||
int xShift = (int) Math.round(xAng * xAmplitude);
|
|
||||||
int yShift = (int) Math.round(yAng * yAmplitude);
|
|
||||||
int x = xCenter + xShift - halfWidth;
|
|
||||||
int y = yCenter - yShift - halHeight;
|
|
||||||
// shape
|
|
||||||
g2.translate(x, y);
|
|
||||||
g2.setPaint(borderColor);
|
|
||||||
g2.draw(shape);
|
|
||||||
g2.setPaint(pointColor);
|
|
||||||
g2.fill(shape);
|
|
||||||
}
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
JoystickEvent joy = getJoystickEvent(arg0);
|
|
||||||
if (joy != null) {
|
|
||||||
lastJoystickEvent = joy;
|
|
||||||
}
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getBackgroundColor() {
|
|
||||||
return backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getPointColor() {
|
|
||||||
return pointColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Shape getShape() {
|
|
||||||
return shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundColor(Color backgroundColor) {
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointColor(Color pointColor) {
|
|
||||||
this.pointColor = pointColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShape(Shape shape) {
|
|
||||||
this.shape = shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract JoystickEvent getJoystickEvent(ExpansionEvent e);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.JoystickEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display nunchuk joystick events.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class NunchukJoystickEventPanel extends JoystickEventPanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JoystickEvent getJoystickEvent(ExpansionEvent e) {
|
|
||||||
if (e instanceof NunchukEvent) {
|
|
||||||
return ((NunchukEvent) e).getNunchukJoystickEvent();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.Orientation;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.NunchukEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display Orientation in a MotionSensingEvent from an expansion.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class OrientationExpansionEventPanel extends OrientationPanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Orientation getOrientationValue(GenericEvent e) {
|
|
||||||
if (e instanceof NunchukEvent) {
|
|
||||||
return ((NunchukEvent) e).getNunchukMotionSensingEvent()
|
|
||||||
.getOrientation();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import wiiusej.values.Orientation;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.IREvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
|
|
||||||
import wiiusej.wiiusejevents.utils.WiimoteListener;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
|
|
||||||
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This panel is used to watch orientation values from a MotionSensingEvent.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public abstract class OrientationPanel extends javax.swing.JPanel implements
|
|
||||||
WiimoteListener {
|
|
||||||
|
|
||||||
private Image mImage;// image for double buffering
|
|
||||||
private Color rollColor = Color.RED;
|
|
||||||
private Color pitchColor = Color.GREEN;
|
|
||||||
private Color yawColor = Color.BLUE;
|
|
||||||
private Color backgroundColor = Color.WHITE;
|
|
||||||
private Color lineColor = Color.BLACK;
|
|
||||||
private ArrayList<Orientation> values = new ArrayList<Orientation>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Background color : White. Roll color : Red. Pitch
|
|
||||||
* color : Green. Yaw color : Blue.
|
|
||||||
*/
|
|
||||||
public OrientationPanel() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used to choose the colors used by the OrientationPanel.
|
|
||||||
*
|
|
||||||
* @param bgColor
|
|
||||||
* background color.
|
|
||||||
* @param rColor
|
|
||||||
* roll color.
|
|
||||||
* @param pColor
|
|
||||||
* pitch color.
|
|
||||||
* @param yColor
|
|
||||||
* yaw color.
|
|
||||||
* @param lColor
|
|
||||||
* line color.
|
|
||||||
*/
|
|
||||||
public OrientationPanel(Color bgColor, Color rColor, Color pColor,
|
|
||||||
Color yColor, Color lColor) {
|
|
||||||
backgroundColor = bgColor;
|
|
||||||
rollColor = rColor;
|
|
||||||
pitchColor = pColor;
|
|
||||||
yawColor = yColor;
|
|
||||||
lineColor = lColor;
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Dimension d = getSize();
|
|
||||||
checkOffScreenImage();
|
|
||||||
Graphics offG = mImage.getGraphics();
|
|
||||||
offG.setColor(backgroundColor);
|
|
||||||
offG.fillRect(0, 0, d.width, d.height);
|
|
||||||
Graphics2D g2 = (Graphics2D) mImage.getGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
// draw medium line
|
|
||||||
double yMiddleFloat = getHeight() / 2.0;
|
|
||||||
int yMiddle = (int) Math.round(yMiddleFloat);
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawLine(0, yMiddle, getWidth(), yMiddle);
|
|
||||||
|
|
||||||
Orientation[] valuesArray = values.toArray(new Orientation[0]);
|
|
||||||
double unit = yMiddleFloat / 180.0;
|
|
||||||
int previousRoll = 0;
|
|
||||||
int previousPitch = 0;
|
|
||||||
int previousYaw = 0;
|
|
||||||
// draw curves
|
|
||||||
for (int i = 0; i < valuesArray.length && i < getWidth(); i++) {
|
|
||||||
Orientation orientation = valuesArray[i];
|
|
||||||
// draw roll
|
|
||||||
g2.setPaint(rollColor);
|
|
||||||
int yDelta = (int) Math.round(unit * orientation.getRoll());
|
|
||||||
int y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousRoll, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousRoll = y;
|
|
||||||
// draw pitch
|
|
||||||
g2.setPaint(pitchColor);
|
|
||||||
yDelta = (int) Math.round(unit * orientation.getPitch());
|
|
||||||
y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousPitch, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousPitch = y;
|
|
||||||
// draw yaw
|
|
||||||
g2.setPaint(yawColor);
|
|
||||||
yDelta = (int) Math.round(unit * orientation.getYaw());
|
|
||||||
y = -1 * yDelta + yMiddle;
|
|
||||||
g2.drawLine(i - 1, previousYaw, i, y);
|
|
||||||
g2.setTransform(new AffineTransform());
|
|
||||||
previousYaw = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw legend
|
|
||||||
g2.setPaint(rollColor);
|
|
||||||
g2.drawLine(5, getHeight() - 10, 25, getHeight() - 10);
|
|
||||||
g2.setPaint(pitchColor);
|
|
||||||
g2.drawLine(60, getHeight() - 10, 80, getHeight() - 10);
|
|
||||||
g2.setPaint(yawColor);
|
|
||||||
g2.drawLine(120, getHeight() - 10, 140, getHeight() - 10);
|
|
||||||
|
|
||||||
g2.setPaint(lineColor);
|
|
||||||
g2.drawString("Roll", 30, getHeight() - 5);
|
|
||||||
g2.drawString("Pitch", 85, getHeight() - 5);
|
|
||||||
g2.drawString("Yaw", 145, getHeight() - 5);
|
|
||||||
g2.drawString("0", 2, yMiddle - 5);
|
|
||||||
g2.drawString("180", 2, 10);
|
|
||||||
g2.drawString("-180", 2, getHeight() - 15);
|
|
||||||
// put offscreen image on the screen
|
|
||||||
g.drawImage(mImage, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check if the mImage variable has been initialized. If it's not the case
|
|
||||||
* it initializes it with the dimensions of the panel. mImage is for double
|
|
||||||
* buffering.
|
|
||||||
*/
|
|
||||||
private void checkOffScreenImage() {
|
|
||||||
Dimension d = getSize();
|
|
||||||
if (mImage == null || mImage.getWidth(null) != d.width
|
|
||||||
|| mImage.getHeight(null) != d.height) {
|
|
||||||
mImage = createImage(d.width, d.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onIrEvent(IREvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onExpansionEvent(ExpansionEvent arg0) {
|
|
||||||
draw(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusEvent(StatusEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDisconnectionEvent(DisconnectionEvent arg0) {
|
|
||||||
// Clear points.
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerInsertedEvent(
|
|
||||||
ClassicControllerInsertedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClassicControllerRemovedEvent(
|
|
||||||
ClassicControllerRemovedEvent arg0) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
private void draw(GenericEvent arg0) {
|
|
||||||
if (values.size() >= getWidth()) {
|
|
||||||
// if there are as many values as pixels in the width
|
|
||||||
// clear points
|
|
||||||
values.clear();
|
|
||||||
}
|
|
||||||
Orientation orientation = getOrientationValue(arg0);
|
|
||||||
if (orientation != null)
|
|
||||||
values.add(orientation);
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Orientation getOrientationValue(GenericEvent e);
|
|
||||||
|
|
||||||
public Color getBackgroundColor() {
|
|
||||||
return backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getPitchColor() {
|
|
||||||
return pitchColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getRollColor() {
|
|
||||||
return rollColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getYawColor() {
|
|
||||||
return yawColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackgroundColor(Color backgroundColor) {
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineColor(Color lineColor) {
|
|
||||||
this.lineColor = lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPitchColor(Color pitchColor) {
|
|
||||||
this.pitchColor = pitchColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRollColor(Color rollColor) {
|
|
||||||
this.rollColor = rollColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setYawColor(Color yawColor) {
|
|
||||||
this.yawColor = yawColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearView() {
|
|
||||||
values.clear();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called from within the constructor to initialize the form.
|
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
|
||||||
* regenerated by the Form Editor.
|
|
||||||
*/
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
|
||||||
// Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
||||||
this.setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
|
|
||||||
Short.MAX_VALUE));
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of WiiuseJ.
|
|
||||||
*
|
|
||||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* WiiuseJ is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package wiiusej.utils;
|
|
||||||
|
|
||||||
import wiiusej.values.Orientation;
|
|
||||||
import wiiusej.wiiusejevents.GenericEvent;
|
|
||||||
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Panel to display Orientation in a MotionSensingEvent from a wiimote.
|
|
||||||
*
|
|
||||||
* @author guiguito
|
|
||||||
*/
|
|
||||||
public class OrientationWiimoteEventPanel extends OrientationPanel {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Orientation getOrientationValue(GenericEvent e) {
|
|
||||||
if (e instanceof MotionSensingEvent) {
|
|
||||||
return ((MotionSensingEvent) e).getOrientation();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
BIN
java/wiiuse.dll
BIN
java/wiiuse.dll
Binary file not shown.
BIN
java/wiiusej.dll
BIN
java/wiiusej.dll
Binary file not shown.
Reference in New Issue
Block a user