本文整理了Java中net.java.games.input.Event
类的一些代码示例,展示了Event
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event
类的具体详情如下:
包路径:net.java.games.input.Event
类名称:Event
暂无
代码示例来源:origin: MovingBlocks/Terasology
private ControllerAction convertEvent(Controller c, Event event) {
Component comp = event.getComponent();
Identifier id = comp.getIdentifier();
float axisValue = comp.getPollData();
state = event.getValue() != 0 ? ButtonState.DOWN : ButtonState.UP;
Integer buttonId = buttonMap.get(id);
if (buttonId == null) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Event e = new Event();
for (int i = 0; i < cs.length; i++){
Controller c = cs[i];
Identifier id = e.getComponent().getIdentifier();
if (id == Identifier.Axis.POV){
float x = 0, y = 0;
float v = e.getValue();
listener.onJoyAxisEvent(evt2);
}else if (id instanceof Axis){
float value = e.getValue();
JoystickAxis axis = stick.axisIndex.get(e.getComponent());
JoyAxisEvent evt = new JoyAxisEvent(axis, value);
listener.onJoyAxisEvent(evt);
}else if (id instanceof Button){
JoystickButton button = stick.buttonIndex.get(e.getComponent());
JoyButtonEvent evt = new JoyButtonEvent(button, e.getValue() == 1f);
listener.onJoyButtonEvent(evt);
代码示例来源:origin: net.java.jinput/jinput
public final void set(Event other) {
this.set(other.getComponent(), other.getValue(), other.getNanos());
}
代码示例来源:origin: net.java.jinput/wintab-plugin
public Event processPacket(WinTabPacket packet) {
Event newEvent = null;
if(packet.PK_CURSOR==index && lastKnownValue==0) {
lastKnownValue = 1;
newEvent = new Event();
newEvent.set(this, lastKnownValue, packet.PK_TIME*1000);
} else if(packet.PK_CURSOR!=index && lastKnownValue==1) {
lastKnownValue = 0;
newEvent = new Event();
newEvent.set(this, lastKnownValue, packet.PK_TIME*1000);
}
return newEvent;
}
}
代码示例来源:origin: us.ihmc/IHMCJavaToolkit
public static MadCatzV1StickMapping getMapping(Event event)
{
return getMapping(event.getComponent());
}
}
代码示例来源:origin: jinput/jinput
protected final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
if (processed_events_index == 0)
return false;
processed_events_index--;
event.set(processed_events[0]);
Event tmp = processed_events[0];
processed_events[0] = processed_events[processed_events_index];
processed_events[processed_events_index] = tmp;
return true;
}
代码示例来源:origin: com.ardor3d/ardor3d-lwjgl
protected ControllerEvent createControllerEvent(final Controller controller, final Event event) {
return new ControllerEvent(event.getNanos(), controller.getName(), event.getComponent().getIdentifier()
.getName(), event.getValue());
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public Queue<ControllerAction> getInputQueue() {
Queue<ControllerAction> result = new ArrayDeque<>();
Event event = new Event();
Iterator<Controller> it = controllers.iterator();
while (it.hasNext()) {
Controller c = it.next();
if (c.poll()) {
EventQueue queue = c.getEventQueue();
while (queue.getNextEvent(event)) {
ControllerAction action = convertEvent(c, event);
if (action != null) {
result.add(action);
}
}
} else {
removeController(c);
}
}
return result;
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
private double getDPadValue(Event event)
{
double dPadValue = event.getValue();
double value = 0.0;
if (MathTools.epsilonEquals(dPadValue, 0.25, 1e-3))
{
value = 1.0;
}
if (MathTools.epsilonEquals(dPadValue, 0.75, 1e-3))
{
value = -1.0;
}
return value;
}
代码示例来源:origin: us.ihmc.thirdparty.jinput/jinput
public final void set(Event other) {
this.set(other.getComponent(), other.getValue(), other.getNanos());
}
代码示例来源:origin: us.ihmc.thirdparty.jinput/jinput
public Event processPacket(WinTabPacket packet) {
Event newEvent = null;
if(packet.PK_CURSOR==index && lastKnownValue==0) {
lastKnownValue = 1;
newEvent = new Event();
newEvent.set(this, lastKnownValue, packet.PK_TIME*1000);
} else if(packet.PK_CURSOR!=index && lastKnownValue==1) {
lastKnownValue = 0;
newEvent = new Event();
newEvent.set(this, lastKnownValue, packet.PK_TIME*1000);
}
return newEvent;
}
}
代码示例来源:origin: us.ihmc/ihmc-java-toolkit
public static MadCatzFLY5StickMapping getMapping(Event event)
{
return getMapping(event.getComponent());
}
}
代码示例来源:origin: us.ihmc.thirdparty.jinput/jinput
protected final synchronized boolean getNextDeviceEvent(Event event) throws IOException {
if (processed_events_index == 0)
return false;
processed_events_index--;
event.set(processed_events[0]);
Event tmp = processed_events[0];
processed_events[0] = processed_events[processed_events_index];
processed_events[processed_events_index] = tmp;
return true;
}
代码示例来源:origin: us.ihmc.thirdparty.jinput/jinput
private final void resizeEventQueue(int size) {
processed_events = new Event[size];
for (int i = 0; i < processed_events.length; i++)
processed_events[i] = new Event();
processed_events_index = 0;
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
break;
case LEFT_STICK_X:
messager.submitMessage(LeftStickXAxis, (double) event.getValue());
break;
case LEFT_STICK_Y:
messager.submitMessage(LeftStickYAxis, (double) event.getValue());
break;
case RIGHT_STICK_X:
messager.submitMessage(RightStickXAxis, (double) event.getValue());
break;
case RIGHT_STICK_Y:
messager.submitMessage(RightStickYAxis, (double) event.getValue());
break;
case LEFT_TRIGGER:
messager.submitMessage(LeftTriggerAxis, (double) event.getValue());
break;
case RIGHT_TRIGGER:
messager.submitMessage(RightTriggerAxis, (double) event.getValue());
break;
代码示例来源:origin: net.java.jinput/coreapi
public final void set(Event other) {
this.set(other.getComponent(), other.getValue(), other.getNanos());
}
代码示例来源:origin: us.ihmc/ihmc-java-toolkit
private boolean isNewValue(Event event)
{
Float value = lastValues.get(event.getComponent().getName());
if (value != null)
{
if (event.getValue() == value)
{
lastValues.put(event.getComponent().getName(), value);
return false;
}
}
lastValues.put(event.getComponent().getName(), event.getValue());
return true;
}
代码示例来源:origin: jpcsp/jpcsp
private void pollController() {
if (inputController != null && inputController.poll()) {
EventQueue eventQueue = inputController.getEventQueue();
Event event = new Event();
while (eventQueue.getNextEvent(event)) {
Component component = event.getComponent();
float value = event.getValue();
processControllerEvent(component, value);
}
}
}
代码示例来源:origin: us.ihmc/ihmc-java-toolkit
public void queueEvent(Identifier identifier, double value)
{
Event event = new Event();
event.set(identifierToComponentMap.get(identifier), (float) value, System.nanoTime());
eventQueue.add(event);
}
代码示例来源:origin: us.ihmc/IHMCJavaToolkit
public static LogitechExtreme3DMapping getMapping(Event event)
{
return getMapping(event.getComponent());
}
}
内容来源于网络,如有侵权,请联系作者删除!