List of usage examples for com.badlogic.gdx.input GestureDetector GestureDetector
public GestureDetector(GestureListener listener)
From source file:at.juggle.games.counting.CountingGame.java
License:Apache License
@Override public void create() { screenManager = new ScreenManager(this); soundManager = new SoundManager(this); // LOAD ASSETS HERE ... // Loading screen will last until the last one is loaded. assMan = new AssetManager(); // for the menu assMan.load("menu/Ravie_42.fnt", BitmapFont.class); assMan.load("menu/Ravie_72.fnt", BitmapFont.class); assMan.load("menu/menu_background.jpg", Texture.class); // for the credits assMan.load("credits/gradient_top.png", Texture.class); assMan.load("credits/gradient_bottom.png", Texture.class); assMan.load("sprites/balloon.png", Texture.class); assMan.load("sprites/balloonblue.png", Texture.class); assMan.load("sprites/balloongreen.png", Texture.class); assMan.load("sprites/balloonpart.png", Texture.class); assMan.load("sprites/xplode", ParticleEffect.class); assMan.load("sprites/button.png", Texture.class); assMan.load("sprites/button_count.png", Texture.class); assMan.load("sprites/button_question.png", Texture.class); // for the sounds soundManager.preload(assMan);/*from w w w . j a va 2 s.c o m*/ Gdx.input.setInputProcessor(new GestureDetector(new GestureDetector.GestureListener() { @Override public boolean touchDown(float x, float y, int pointer, int button) { return false; } @Override public boolean tap(float x, float y, int count, int button) { return false; } @Override public boolean longPress(float x, float y) { screenManager.setCurrentState(ScreenManager.ScreenState.Menu); return true; } @Override public boolean fling(float velocityX, float velocityY, int button) { return false; } @Override public boolean pan(float x, float y, float deltaX, float deltaY) { return false; } @Override public boolean panStop(float x, float y, int pointer, int button) { return false; } @Override public boolean zoom(float initialDistance, float distance) { return false; } @Override public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) { return false; } @Override public void pinchStop() { } })); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.ScreenGame.java
License:Open Source License
@Override public void show() { Gdx.app.log("Matth", "Screen: SHOW"); // With GdxMenus, this method is called twice if (GlobalSettings.GAME.getTimer().isRunning()) return;//from www .j a v a2s . c om bIsPause = true; // show the countdown at startup game.resumeGame(); bNewGame = false; loopMusic.stop(); // to play at startup game.start(); GlobalSettings.GAME.getTimer().createNewTimer(GraphicManager.TIME); Gdx.input.setInputProcessor(new GestureDetector(new MyGestureListener())); }
From source file:com.axatrikx.solor.view.LevelScreen.java
License:Apache License
/** * @param game/*from w w w .j a v a2 s.com*/ */ public LevelScreen(Solor game) { super(game); camera = new OrthographicCamera(); camera.setToOrtho(false, GameProperties.GAME_VIEWPORT_WIDTH, GameProperties.GAME_VIEWPORT_HEIGHT); Gdx.input.setInputProcessor(new GestureDetector(new InputController(this))); atlas = new TextureAtlas(Gdx.files.internal("images/solor.atlas")); initObjects(); }
From source file:com.badlogic.gdx.tests.Box2DTestCollection.java
License:Apache License
@Override public void create() { if (this.app == null) { this.app = Gdx.app; Box2DTest test = tests[testIndex]; test.create();/*from w w w.java2s . c o m*/ } InputMultiplexer multiplexer = new InputMultiplexer(); multiplexer.addProcessor(this); multiplexer.addProcessor(new GestureDetector(this)); Gdx.input.setInputProcessor(multiplexer); }
From source file:com.badlogic.gdx.tests.BulletTestCollection.java
License:Apache License
@Override public void create() { if (app == null) { app = Gdx.app;//w ww .j ava 2 s .c o m tests[testIndex].create(); } cameraController = new CameraInputController(tests[testIndex].camera); cameraController.activateKey = Keys.CONTROL_LEFT; cameraController.autoUpdate = false; cameraController.forwardTarget = false; cameraController.translateTarget = false; Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this))); font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false); hud = new Stage(); hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE))); fpsLabel.setPosition(0, 0); hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE))); titleLabel.setY(hud.getHeight() - titleLabel.getHeight()); hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE))); instructLabel.setY(titleLabel.getY() - instructLabel.getHeight()); instructLabel.setAlignment(Align.top | Align.left); instructLabel.setText(tests[testIndex].instructions); }
From source file:com.badlogic.gdx.tests.dragome.examples.bullet.BulletTestCollection.java
@Override public void create() { if (app == null) { app = Gdx.app;//from w ww .java 2 s.co m tests[testIndex].create(); } cameraController = new CameraInputController(tests[testIndex].camera); cameraController.activateKey = Keys.CONTROL_LEFT; cameraController.autoUpdate = false; cameraController.forwardTarget = false; cameraController.translateTarget = false; Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this))); font = new BitmapFont(false); hud = new Stage(); hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE))); fpsLabel.setPosition(0, 0); hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE))); titleLabel.setY(hud.getHeight() - titleLabel.getHeight()); hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE))); instructLabel.setY(titleLabel.getY() - instructLabel.getHeight()); instructLabel.setAlignment(Align.top | Align.left); instructLabel.setText(tests[testIndex].instructions); }
From source file:com.gamemaker.screens.GameScreen1.java
License:Apache License
public GameScreen1(Game game, int[] data) { this.game = game; float screenWidth = Gdx.graphics.getWidth(); float screenHeight = Gdx.graphics.getHeight(); float gameWidth = 1280; float gameHeight = screenHeight / (screenWidth / gameWidth); Gdx.app.log("GameScreen1", "attached"); world = new GameWorld(game, data); renderer = new GameRenderer(world, (int) gameHeight); Gdx.input.setInputProcessor(new GestureDetector(new myGestureListener(world, game))); }
From source file:com.gamemaker.screens.GameScreenFin.java
License:Apache License
public GameScreenFin(Game game, int[] data) { this.game = game; float screenWidth = Gdx.graphics.getWidth(); float screenHeight = Gdx.graphics.getHeight(); float gameWidth = 1280; float gameHeight = screenHeight / (screenWidth / gameWidth); Gdx.app.log("GameScreen", "attached"); worldFin = new GameWorld(game, data); worldFin.setToFinalState();//from www .j a va 2 s.c om rendererFin = new GameRenderer(worldFin, (int) gameHeight); Gdx.input.setInputProcessor(new GestureDetector(new myGestureListener(worldFin, game))); }
From source file:com.liamhartery.pinch.screens.InstructionsScreen.java
License:Creative Commons License
public InstructionsScreen(final PinchGame pinch) { game = pinch;/* ww w . j a v a 2s . co m*/ screenWidth = 800; screenHeight = 480; camera = new OrthographicCamera(); camera.setToOrtho(false, screenWidth, screenHeight); game.bigfont.getData().setScale(0.8f, 0.8f); bigLayout = new GlyphLayout(game.bigfont, "controls"); bigWidth = bigLayout.width; GestureDetector gd = new GestureDetector(this); Gdx.input.setInputProcessor(gd); }
From source file:com.quadbits.gdxhelper.screens.LWPScreen.java
License:Apache License
public LWPScreen(LWPGame game) { // Game/*from w w w . jav a2 s. com*/ this.game = game; // Input processing inputMultiplexer = new InputMultiplexer(); gestureDetector = new GestureDetector(this); gestureDetector.setTapSquareSize(32 * Gdx.graphics.getDensity()); panningEnabled = game.isPanningEnabled(); flingEnabled = game.isFlingEnabled(); flingVelocityX = 0; flingVelocityY = 0; flingDampFactor = DEFAULT_FLING_DAMP_FACTOR; // Rendering renderCount = 0; maxSleepTimeMillis = 0; maxDeltaTime = DEFAULT_MAX_DELTA_TIME_MILLIS; continuousRendering = false; // Scroll scrollXChangeListeners = new ArrayList<ScrollChangeListener>(); scrollYChangeListeners = new ArrayList<ScrollChangeListener>(); scrollX = 0.5f; scrollY = 0.5f; // Shaders etc1Shader = null; etc1aShader = null; defaultShader = DefaultShader.NONE; }