All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mathiewz.slick.command.KeyControl Maven / Gradle / Ivy

Go to download

The main purpose of this libraryis to modernize and maintain the slick2D library.

The newest version!
package com.github.mathiewz.slick.command;

/**
 * A control relating to a command indicate that it should be fired when a specific key is pressed
 * or released.
 *
 * @author joverton
 */
public class KeyControl implements Control {
    /** The key code that needs to be pressed */
    private final int keycode;

    /**
     * Create a new control that caused an command to be fired on a key pressed/released
     *
     * @param keycode
     *            The code of the key that causes the command
     */
    public KeyControl(int keycode) {
        this.keycode = keycode;
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object o) {
        if (o instanceof KeyControl) {
            return ((KeyControl) o).keycode == keycode;
        }

        return false;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return keycode;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy