Package org.terasology.input

Examples of org.terasology.input.Input


    @In
    private InputSystem inputSystem;

    @Command(shortDescription = "Maps a key to a function")
    public String bindKey(@CommandParam("key") String key, @CommandParam("function") String bind) {
        Input keyInput = Keyboard.Key.find(key);
        if (keyInput != null) {
            inputSystem.linkBindButtonToKey(keyInput.getId(), new SimpleUri(bind));
            StringBuilder builder = new StringBuilder();
            builder.append("Mapped ").append(keyInput.getDisplayName()).append(" to action ");
            builder.append(bind);
            return builder.toString();
        }
        throw new IllegalArgumentException("Unknown key: " + key);
    }
View Full Code Here


        Set<Input> uniqueInputs = Sets.newLinkedHashSet(inputs);

        // Clear existing usages of the given inputs
        Iterator<Input> iterator = data.values().iterator();
        while (iterator.hasNext()) {
            Input i = iterator.next();
            if (uniqueInputs.contains(i)) {
                iterator.remove();
            }
        }
        data.replaceValues(bindUri, uniqueInputs);
View Full Code Here

    private void addBind(Name moduleName, Class<?> buttonEvent, RegisterBindButton info) {
        List<Input> defaultInputs = Lists.newArrayList();
        for (Annotation annotation : buttonEvent.getAnnotations()) {
            if (annotation instanceof DefaultBinding) {
                DefaultBinding defaultBinding = (DefaultBinding) annotation;
                Input input = defaultBinding.type().getInput(defaultBinding.id());
                if (!data.values().contains(input)) {
                    defaultInputs.add(input);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.terasology.input.Input

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.