Exemplo n.º 1
0
 private void updateAxisInputsFor(Name moduleId, Iterable<Class<?>> classes) {
   for (Class<?> axisEvent : classes) {
     if (AxisEvent.class.isAssignableFrom(axisEvent)) {
       RegisterRealBindAxis info = axisEvent.getAnnotation(RegisterRealBindAxis.class);
       SimpleUri bindUri = new SimpleUri(moduleId, info.id());
       if (!hasBinds(bindUri)) {
         addBind(moduleId, axisEvent, info.id());
       }
     }
   }
 }
Exemplo n.º 2
0
 private void addAxisDefaultsFor(Name moduleId, Iterable<Class<?>> classes) {
   for (Class<?> axisEvent : classes) {
     if (AxisEvent.class.isAssignableFrom(axisEvent)) {
       RegisterRealBindAxis info = axisEvent.getAnnotation(RegisterRealBindAxis.class);
       addBind(moduleId, axisEvent, info.id());
     }
   }
 }
Exemplo n.º 3
0
 private void registerRealAxisBinds(
     InputSystem inputSystem, ModuleEnvironment environment, Iterable<Class<?>> classes) {
   for (Class<?> registerBindClass : classes) {
     RegisterRealBindAxis info = registerBindClass.getAnnotation(RegisterRealBindAxis.class);
     Name moduleId = environment.getModuleProviding(registerBindClass);
     SimpleUri id = new SimpleUri(moduleId, info.id());
     if (BindAxisEvent.class.isAssignableFrom(registerBindClass)) {
       try {
         BindAxisEvent instance = (BindAxisEvent) registerBindClass.newInstance();
         BindableAxis bindAxis = inputSystem.registerRealBindAxis(id.toString(), instance);
         bindAxis.setSendEventMode(info.eventMode());
         for (Input input : getBinds(id)) {
           inputSystem.linkAxisToInput(input, id);
         }
         logger.debug("Registered axis bind: {}", id);
       } catch (InstantiationException | IllegalAccessException e) {
         logger.error("Failed to register axis bind \"{}\"", id, e);
       }
     } else {
       logger.error("Failed to register axis bind \"{}\", does not extend BindAxisEvent", id);
     }
   }
 }