public void update(float deltaTime) { if (Gdx.input.justTouched()) { guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0)); if (OverlapTester.pointInRectangle(playBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new GameScreen(game)); return; } if (OverlapTester.pointInRectangle(highscoresBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new HighscoresScreen(game)); return; } if (OverlapTester.pointInRectangle(helpBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new HelpScreen(game)); return; } if (OverlapTester.pointInRectangle(soundBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); Settings.soundEnabled = !Settings.soundEnabled; if (Settings.soundEnabled) Assets.music.play(); else Assets.music.pause(); } } }
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 MainMenuScreen(game)); } } }
public void update(float deltaTime) { if (Gdx.input.justTouched()) { guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0)); if (OverlapTester.pointInRectangle(nextBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new MainMenuScreen(game)); return; } } }
@Override protected void onChangeState() { try { // If we switched state and it is a screen, update the game screen State state = getCurrentState(); if (state instanceof Screen) { game.setScreen((Screen) state); setChanged(); notifyObservers(); } } catch (IllegalStateException e) { // No state } }
private void updatePaused() { if (Gdx.input.justTouched()) { guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0)); if (OverlapTester.pointInRectangle(resumeBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); state = GAME_RUNNING; return; } if (OverlapTester.pointInRectangle(quitBounds, touchPoint.x, touchPoint.y)) { Assets.playSound(Assets.clickSound); game.setScreen(new MainMenuScreen(game)); return; } } }
@Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { if (!wasTouchDown) { return false; } wasTouchDown = false; for (EventButton evBtn : _buttons) { evBtn.btn.setNormalMode(); if (this.isButtonUnderPoint(evBtn.btn)) { if (evBtn.type == -1) { GooglePlayData.showAchievements(); } else { _game.setScreen(ScreenControl.getScreen(evBtn.type)); } } } return super.touchUp(screenX, screenY, pointer, button); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); textFont.setColor(Color.YELLOW); textFont.draw( batch, String.format("%4s%9s%9s", "RANK", "SCORE", "NAME"), (int) (1200 * .12), (int) (1824 * .875)); for (int i = 0; i < 10; i++) { textFont.setColor(scoreColors[i]); drawScore(i); } batch.draw(backButton.getTexture(), backButton.getX(), backButton.getY()); batch.end(); if (Gdx.input.isKeyPressed(Input.Keys.BACK)) MainGame.setScreen(new MenuScreen(MainGame)); }
// --------------------------------------------------- // 画像移動 // 画面端にいったらステート移行 // --------------------------------------------------- public void moveSprite() { // クリックされたらメニューの文字が移動 if (scrollFlag) { // 加速して画面外へ spritePositionX += MOVE_SPEED; // スプライト移動 modeContinue.setPosition(spritePositionX, 0); modeNewGame.setPosition(spritePositionX, -4); modeLoadGame.setPosition(spritePositionX, -8); modeNetwork.setPosition(spritePositionX, -12); modeOption.setPosition(spritePositionX, -16); modeExit.setPosition(spritePositionX, -20); } // メニューの文字が画面外まで移動したらゲームメイン移行 if (spritePositionX >= FADE_MENU) { scrollNinja.setScreen(new GameMain(scrollNinja, nextStageNum)); } }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); backGroundSprite.draw(batch); batch.draw( backGroundSprite, backGroundSprite.getX(), backGroundSprite.getY(), backGroundSprite.getWidth(), backGroundSprite.getHeight()); batch.end(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); if (Gdx.input.isKeyPressed(Input.Keys.BACK)) { game.setScreen(new LoginScreen(game)); } }
private void updateGameOver() { if (Gdx.input.justTouched()) { game.setScreen(new MainMenuScreen(game)); } }
@Override public void setScreen(Screen screen) { super.setScreen(screen); }
private void updateGameOver2(float deltaTime) { if (Gdx.input.justTouched()) game.setScreen(new MainMenuScreen(game)); }
@Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { if (backSelected && backButton.contains(screenX, screenY)) MainGame.setScreen(new MenuScreen(MainGame)); return false; }