aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2015-01-20 20:47:55 +0100
committerJulien Gouesse <[email protected]>2015-01-20 20:47:55 +0100
commitaf94ef70aa1c5238db332c655b047cf6f597a5e8 (patch)
treed15081bf024c4989642e9a57bafe3caed6de48ea /ardor3d-jogl
parent369d3b7f81a3395fe93e83e1c9ae7d2e73b70482 (diff)
Moves the controller based on JInput into a separate sub-project called ardor3d-jinput
Diffstat (limited to 'ardor3d-jogl')
-rw-r--r--ardor3d-jogl/build.gradle1
-rw-r--r--ardor3d-jogl/pom.xml4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java126
3 files changed, 0 insertions, 131 deletions
diff --git a/ardor3d-jogl/build.gradle b/ardor3d-jogl/build.gradle
index c5f99ac..638a163 100644
--- a/ardor3d-jogl/build.gradle
+++ b/ardor3d-jogl/build.gradle
@@ -4,6 +4,5 @@ dependencies {
compile project(':ardor3d-core')
compile group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:'2.2.4'
compile group: 'org.jogamp.jogl', name: 'jogl-all-main', version:'2.2.4'
- compile group: 'net.java.jinput', name: 'jinput', version:'2.0.6'
compile group: 'org.eclipse.swt', name: 'org.eclipse.swt.gtk.linux.x86_64', version:'3.8'
}
diff --git a/ardor3d-jogl/pom.xml b/ardor3d-jogl/pom.xml
index e14ff2a..f0d90cc 100644
--- a/ardor3d-jogl/pom.xml
+++ b/ardor3d-jogl/pom.xml
@@ -47,10 +47,6 @@
<artifactId>jocl-main</artifactId>
</dependency-->
<dependency>
- <groupId>net.java.jinput</groupId>
- <artifactId>jinput</artifactId>
- </dependency>
- <dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>${swt.artifactId}</artifactId>
<version>${swt.version}</version>
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java
deleted file mode 100644
index 52ab50a..0000000
--- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.input.jinput;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import net.java.games.input.Component;
-import net.java.games.input.Component.Identifier;
-import net.java.games.input.Controller;
-import net.java.games.input.Controller.Type;
-import net.java.games.input.ControllerEnvironment;
-import net.java.games.input.Event;
-
-import com.ardor3d.input.ControllerEvent;
-import com.ardor3d.input.ControllerInfo;
-import com.ardor3d.input.ControllerState;
-import com.ardor3d.input.ControllerWrapper;
-import com.google.common.collect.AbstractIterator;
-import com.google.common.collect.PeekingIterator;
-
-public class JInputControllerWrapper implements ControllerWrapper {
-
- protected final Event _event = new Event();
- protected final List<ControllerEvent> _events = Collections.synchronizedList(new ArrayList<ControllerEvent>());
- protected JInputControllerEventIterator _eventsIt = new JInputControllerEventIterator();
- protected final List<ControllerInfo> _controllers = new ArrayList<ControllerInfo>();
- protected static boolean _inited = false;
-
- @Override
- public PeekingIterator<ControllerEvent> getEvents() {
- init();
- if (!_eventsIt.hasNext()) {
- _eventsIt = new JInputControllerEventIterator();
- }
- for (final Controller controller : ControllerEnvironment.getDefaultEnvironment().getControllers()) {
- controller.poll();
- while (controller.getEventQueue().getNextEvent(_event)) {
- if (controller.getType() != Type.KEYBOARD && controller.getType() != Type.MOUSE) {
- _events.add(createControllerEvent(controller, _event));
- }
- }
- }
-
- return _eventsIt;
- }
-
- @Override
- public int getControllerCount() {
- init();
- return _controllers.size();
- }
-
- @Override
- public ControllerInfo getControllerInfo(final int controllerIndex) {
- init();
- return _controllers.get(controllerIndex);
- }
-
- @Override
- public synchronized void init() {
- if (_inited) {
- return;
- }
-
- try {
- ControllerEnvironment.getDefaultEnvironment();
-
- for (final Controller controller : ControllerEnvironment.getDefaultEnvironment().getControllers()) {
- if (controller.getType() != Type.KEYBOARD && controller.getType() != Type.MOUSE) {
- _controllers.add(getControllerInfo(controller));
- for (final Component component : controller.getComponents()) {
- ControllerState.NOTHING.set(controller.getName(), component.getIdentifier().getName(), 0);
- }
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- } finally {
- _inited = true;
- }
- }
-
- protected ControllerInfo getControllerInfo(final Controller controller) {
- final List<String> axisNames = new ArrayList<String>();
- final List<String> buttonNames = new ArrayList<String>();
-
- for (final Component comp : controller.getComponents()) {
- if (comp.getIdentifier() instanceof Identifier.Axis) {
- axisNames.add(comp.getName());
- } else if (comp.getIdentifier() instanceof Identifier.Button) {
- buttonNames.add(comp.getName());
- }
- }
-
- return new ControllerInfo(controller.getName(), axisNames, buttonNames);
- }
-
- protected ControllerEvent createControllerEvent(final Controller controller, final Event event) {
- return new ControllerEvent(event.getNanos(), controller.getName(), event.getComponent().getIdentifier()
- .getName(), event.getValue());
- }
-
- protected class JInputControllerEventIterator extends AbstractIterator<ControllerEvent> implements
- PeekingIterator<ControllerEvent> {
-
- @Override
- protected ControllerEvent computeNext() {
- if (_events.size() > 0) {
- final ControllerEvent controllerEvent = _events.remove(0);
- return controllerEvent;
- } else {
- return endOfData();
- }
- }
- }
-} \ No newline at end of file