Android Open Source - YOGOSec Input






From Project

Back to project page YOGOSec.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project YOGOSec listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package YOGOSec.core.input;
//from ww w.j  a  v a 2  s .c o m
import YOGOSec.core.Game;
import YOGOSec.core.util.Point2i;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.Vector3;

/**
 * @author Aritz Lopez
 * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
 */
public class Input implements InputProcessor {
    private final Game game;

    public Input(Game game) {
        this.game = game;
    }

    @Override
    public boolean keyDown(int keycode) {
        return this.game.getScreen().keyDown(keycode);
    }

    @Override
    public boolean keyUp(int keycode) {
        return this.game.getScreen().keyUp(keycode);
    }

    @Override
    public boolean keyTyped(char character) {
        return false;
    }

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        return this.game.getScreen().touchDown(this.unproject(screenX, screenY), pointer, button);
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        return this.game.getScreen().touchUp(this.unproject(screenX, screenY), pointer, button);
    }

    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        return this.game.getScreen().touchDragged(this.unproject(screenX, screenY), pointer);
    }

    @Override
    public boolean mouseMoved(int screenX, int screenY) {
        return this.game.getScreen().mouseMoved(this.unproject(screenX, screenY));
    }

    @Override
    public boolean scrolled(int amount) {
        return this.game.getScreen().scrolled(amount);
    }

    public Point2i unproject(int x, int y) {
        Vector3 vector3 = new Vector3(x, y, 0);
        this.game.getRender().getCamera().unproject(vector3);
        return new Point2i((int) vector3.x, (int) vector3.y);
    }
}




Java Source Code List

YOGOSec.android.GameActivity.java
YOGOSec.core.Game.java
YOGOSec.core.gui.Button.java
YOGOSec.core.gui.GUIComponent.java
YOGOSec.core.gui.GUI.java
YOGOSec.core.gui.IActionListener.java
YOGOSec.core.gui.InputListener.java
YOGOSec.core.gui.ProgressBar.java
YOGOSec.core.input.Input.java
YOGOSec.core.render.Render.java
YOGOSec.core.render.YUpPixmap.java
YOGOSec.core.screens.MainMenuScreen.java
YOGOSec.core.screens.MyScreen.java
YOGOSec.core.util.Point2f.java
YOGOSec.core.util.Point2i.java
YOGOSec.core.util.Point.java
YOGOSec.core.util.Rectangle.java
YOGOSec.core.util.Rectanglef.java
YOGOSec.core.util.Rectanglei.java
YOGOSec.java.GameDesktop.java