protected void addComponent( Component comp ) { Identifier id = comp.getIdentifier(); if( id instanceof Button ) { addButton(comp); } else if( id instanceof Axis ) { addAxis(comp); } else { logger.log(Level.FINE, "Ignoring: \"{0}\"", comp); } }
protected void addButton( Component comp ) { logger.log(Level.FINE, "Adding button: \"{0}\" id:" + comp.getIdentifier(), comp); Identifier id = comp.getIdentifier(); if( !(id instanceof Button) ) { throw new IllegalArgumentException( "Component is not an button:" + comp ); } String name = comp.getName(); String original = id.getName(); try { Integer.parseInt(original); } catch (NumberFormatException e){ original = String.valueOf(buttonIndex.size()); } String logicalId = JoystickCompatibilityMappings.remapComponent( controller.getName(), original ); if( logicalId != original ) { logger.log(Level.FINE, "Remapped:" + original + " to:" + logicalId); } JoystickButton button = new DefaultJoystickButton( getInputManager(), this, getButtonCount(), name, logicalId ); addButton(button); buttonIndex.put( comp, button ); }
private ControllerAction convertEvent(Controller c, Event event) { Component comp = event.getComponent(); Identifier id = comp.getIdentifier(); float axisValue = comp.getPollData(); Input input;
protected void addAxis( Component comp ) { logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + comp.getIdentifier(), comp ); Identifier id = comp.getIdentifier(); if( !(id instanceof Axis) ) { throw new IllegalArgumentException( "Component is not an axis:" + comp );
Identifier id = e.getComponent().getIdentifier(); if (id == Identifier.Axis.POV){ float x = 0, y = 0;
private void initializeIdentifiers() { for (Component component : joystickController.getComponents()) { identifiers.add(component.getIdentifier()); } }
private static Thrustmaster16000M getMapping(Component component) { return getMapping(component.getIdentifier()); }
private static Thrustmaster16000M getMapping(Component component) { return getMapping(component.getIdentifier()); }
private void initializeIdentifiers() { for (Component component : joystickController.getComponents()) { identifiers.add(component.getIdentifier()); } }
private static SaitekX52Mapping getMapping(Component component) { return getMapping(component.getIdentifier()); }
private static LogitechExtreme3DMapping getMapping(Component component) { return getMapping(component.getIdentifier()); }
private static MadCatzFLY5StickMapping getMapping(Component component) { return getMapping(component.getIdentifier()); }
private static SaitekX52Mapping getMapping(Component component) { return getMapping(component.getIdentifier()); }
private static LogitechExtreme3DMapping getMapping(Component component) { return getMapping(component.getIdentifier()); }
protected void addComponent( Component comp ) { Identifier id = comp.getIdentifier(); if( id instanceof Button ) { addButton(comp); } else if( id instanceof Axis ) { addAxis(comp); } else { logger.log(Level.FINE, "Ignoring: \"{0}\"", comp); } }
protected ControllerInfo getControllerInfo(final Controller controller) { final List<String> axisNames = Lists.newArrayList(); final List<String> buttonNames = Lists.newArrayList(); 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); }
public AxisPanel(Component ax){ axis = ax; setLayout(new BorderLayout()); add(new JLabel(ax.getName()+"("+ax.getIdentifier()+")"), BorderLayout.NORTH); }
public AxisPanel(Component ax){ axis = ax; setLayout(new BorderLayout()); add(new JLabel(ax.getName()+"("+ax.getIdentifier()+")"), BorderLayout.NORTH); }
private void handlePollEvents(Event event) { for (final BiConsumer<String, Float> cons : this.pollConsumer) { cons.accept(event.getComponent().getIdentifier().getName(), event.getValue()); } final List<Consumer<Float>> consumers = this.componentPollConsumer.get(event.getComponent().getIdentifier().getName()); if (consumers != null) { for (final Consumer<Float> cons : consumers) { cons.accept(event.getValue()); } } }
protected ControllerEvent createControllerEvent(final Controller controller, final Event event) { return new ControllerEvent(event.getNanos(), controller.getName(), event.getComponent().getIdentifier() .getName(), event.getValue()); }