@Override public boolean justTouched () { return input.justTouched(); }
@Override public void render () { if (Gdx.input.justTouched()) Gdx.app.exit(); }
@Override public void render () { if (Gdx.input.justTouched()) { expectIt = true; Gdx.app.postRunnable(new Runnable() { @Override public void run () { throw new RuntimeException("This is a test of the uncaught exception handler."); } }); } } }
public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, message, 10, 40); batch.end(); if (Gdx.input.justTouched()) { } } }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, "Touch screen to vibrate", 100, 100); batch.end(); if (Gdx.input.justTouched()) Gdx.input.vibrate(100); } }
public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, "input: " + text, 0, Gdx.graphics.getHeight()); batch.end(); if (Gdx.input.justTouched()) Gdx.input.setOnscreenKeyboardVisible(true); }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); font.draw(batch, textBuffer, 0, Gdx.graphics.getHeight() - 20); batch.end(); // bring up the keyboard if we touch the screen if (Gdx.input.justTouched()) { Gdx.input.setOnscreenKeyboardVisible(true); textBuffer = new SimpleCharSequence(); } }
public void render () { if (Gdx.input.justTouched()) { for (int i = 0; i < 10; i++) { if (font != null) { font.dispose(); } FileHandle fontFile = Gdx.files.internal("data/arial.ttf"); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile); FreeTypeFontParameter parameter = new FreeTypeFontParameter(); parameter.size = 15; font = generator.generateFont(parameter); generator.dispose(); } for (int i = 0; i < 10; i++) System.gc(); Gdx.app.log("FreeTypeDisposeTest", "generated 10 fonts"); Gdx.app.log("FreeTypeDisposeTest", Gdx.app.getJavaHeap() + ", " + Gdx.app.getNativeHeap()); } } }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (manager.update() && manager.isLoaded("size10.ttf")) { batch.begin(); manager.get("size10.ttf", BitmapFont.class).draw(batch, "First font!", 20, 20); manager.get("size20.ttf", BitmapFont.class).draw(batch, "Second font!", 20, 50); manager.get("data/default.fnt", BitmapFont.class).draw(batch, "Default font!", 20, 100); batch.end(); } if (Gdx.input.justTouched() && manager.isLoaded("size10.ttf")) { // unload all the things and check if they really get disposed properly manager.unload("size10.ttf"); manager.finishLoading(); if (manager.isLoaded("size10.ttf")) throw new RuntimeException("broken"); if (!manager.isLoaded("size20.ttf")) throw new RuntimeException("broken"); manager.unload("size20.ttf"); manager.finishLoading(); if (manager.isLoaded("size10.ttf")) throw new RuntimeException("broken"); if (manager.isLoaded("size20.ttf")) throw new RuntimeException("broken"); } }
@Override public void render () { if (Gdx.input.justTouched()) { Gdx.app.log("Input Test", "just touched, button: " + (Gdx.input.isButtonPressed(Buttons.LEFT) ? "left " : "") + (Gdx.input.isButtonPressed(Buttons.MIDDLE) ? "middle " : "") + (Gdx.input.isButtonPressed(Buttons.RIGHT) ? "right" : "") + (Gdx.input.isButtonPressed(Buttons.BACK) ? "back" : "") + (Gdx.input.isButtonPressed(Buttons.FORWARD) ? "forward" : "")); } for (int i = 0; i < 10; i++) { if (Gdx.input.getDeltaX(i) != 0 || Gdx.input.getDeltaY(i) != 0) { Gdx.app.log("Input Test", "delta[" + i + "]: " + Gdx.input.getDeltaX(i) + ", " + Gdx.input.getDeltaY(i)); } } // Gdx.input.setCursorPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2); // if(Gdx.input.isTouched()) { // Gdx.app.log("Input Test", "is touched"); // } }
@Override public void render () { Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl.glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); cam.update(); modelInstance.transform.rotate(Vector3.Y, 45 * Gdx.graphics.getDeltaTime()); modelBatch.begin(cam); modelBatch.render(modelInstance); modelBatch.end(); if (Gdx.input.justTouched() || fbTexture == null) { if (fbTexture != null) fbTexture.getTexture().dispose(); fbTexture = ScreenUtils.getFrameBufferTexture(); } batch.begin(); if (fbTexture != null) { batch.draw(fbTexture, 0, 0, 100, 100); } font.draw(batch, "Touch screen to take a snapshot", 10, 40); batch.end(); }
@Override public void render () { currentPosition = music.getPosition(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(buttons, 0, 0); font.draw(batch, (int)currentPosition / 60 + ":" + (int)currentPosition % 60, 365, 35); batch.end(); sliderUpdating = true; slider.setValue((currentPosition / songDuration) * 100f); sliderUpdating = false; stage.act(); stage.draw(); if (Gdx.input.justTouched()) { if (Gdx.input.getY() > Gdx.graphics.getHeight() - 64) { if (Gdx.input.getX() < 64) { music.play(); } if (Gdx.input.getX() > 64 && Gdx.input.getX() < 128) { music.stop(); } if (Gdx.input.getX() > 128 && Gdx.input.getX() < 192) { music.pause(); } } } }
batch.end(); if (Gdx.input.justTouched()) { useStage = !useStage;
batch.end(); if (Gdx.input.justTouched()) { if (fullscreen) { Gdx.graphics.setWindowedMode(480, 320);
@Override public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) { if (!button.isDisabled() && activeTab != tab && Gdx.input.justTouched() == false && pointer == -1) { setCloseButtonOnMouseMove(); } }
@Override public void handleInput() { if(Gdx.input.justTouched()){ gsm.set(new PlayState(gsm)); } }
@Override public void handleInput() { if(Gdx.input.justTouched()){ gsm.set(new PlayState(gsm)); } }
private void updateLevelEnd () { if (Gdx.input.justTouched()) { engine.removeAllEntities(); world = new World(engine); world.score = lastScore; state = GAME_READY; } }
@Override public void render(float delta) { if(Gdx.input.justTouched()) { game.setScreen(new PlayScreen((MarioBros) game)); dispose(); } Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); }
public void update () { if (Gdx.input.justTouched()) { guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0)); if (nextBounds.contains(touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new HelpScreen5(game)); } } }