public MenuScreen(Game game) { Box2D.init(); this.game = game; world = new World(new Vector2(0, 0), false); stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT)); preferences = new GamePreferences(); audioManager = AudioManager.getInstance(); Gdx.input.setInputProcessor(stage); FlappySpinner.gameManager.changeBackgroundColor("#4ec0ca"); setUpBackground(); setUpButtons(); setUpLogo(); }
public MarketScreen(Game aGame) { this.aGame = aGame; audioManager = AudioManager.getInstance(); preferences = new GamePreferences(); stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT)); Gdx.input.setInputProcessor(stage); initSkins(); setUpBackground(); setUpHomeButton(); setUpSkinImages(); setUpNextButton(); setUpPreviousButton(); setUpUseButton(); setUpBuyButton(); setUpLabels(); changeShownSkin(); }
public SettingsScreen(Game game) { this.aGame = game; preferences = new GamePreferences(); audioManager = AudioManager.getInstance(); stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT)); Gdx.input.setInputProcessor(stage); setUpBackground(); setUpLabels(); setUpHomeButton(); setUpMusicButton(); setUpSoundButton(); setUpGitHubButton(); }
/** * Constructor * @param game */ public GameScreen(Game game, Client client, Server server) { super(game, client, server); this.sendCommand = client.getSendCommand(); this.camera = new OrthographicCamera(); this.stage = new Stage(new StretchViewport(Constants.SCREENWIDTH, Constants.SCREENHEIGHT, camera)); this.mapManager = new MapLoader(camera, sendCommand); this.entityManager = new EntityManager(camera, mapManager, sendCommand, inputHandler); this.processData = new ClientProcessData(entityManager, mapManager); this.mainPlayerHud = new MainPlayerHud(entityManager, game, server, client, mapManager, camera); this.camera.zoom = Constants.DEFAULTZOOM; // Controls if(Constants.ISRUNNINGONSMARTPHONE) { Gdx.input.setInputProcessor(mainPlayerHud.stage); camera.zoom = Constants.SMARTPHONEZOOM; }else { inputHandler.setInputSource(mainPlayerHud.stage); Gdx.input.setCursorCatched(true); } }
private void fadeLogic(float delta) { if (_fadeIn) { _fade -= FADE_SPEED * delta; if (_fade < 0) { _fadeIn = false; _fadeOut = true; _fade = -1; } } else if (_fadeOut && _delay > 0) { _delay -= delta; } else if (_fadeOut) { _fade += FADE_SPEED * delta; if (_fade > 1.5f) { ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); return; } } }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_5,done)); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_3,done)); } }).start(tweenManager); }
private void leaveAnimation(final Screen setScreen){ //setup a parallel event Timeline.createParallel().beginParallel() .push(Tween.to(heading, ActorAccessor.Y, 2f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level1, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level2, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level3, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level4, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level5, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level6, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l1, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l2, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l3, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l4, ActorAccessor.Y, .75f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l5, ActorAccessor.Y, .75f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l6, ActorAccessor.Y, .75f).target(-Gdx.graphics.getHeight())) .push(Tween.to(more, ActorAccessor.Y, .5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l7, ActorAccessor.Y, .5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(setScreen); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_4,done)); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score, ScoreManager.H2O,done)); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_1,done)); } }).start(tweenManager); }
private void leaveAnimation(final Screen setScreen){ //setup a parallel event Timeline.createParallel().beginParallel() .push(Tween.to(heading, ActorAccessor.Y, 2f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level1, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l1, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(level2, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(l2, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(setScreen); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score, ScoreManager.CH4,done)); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_6,done)); } }).start(tweenManager); }
private void leaveScreen(){ Timeline.createParallel().beginParallel() .push(Tween.to(right, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(left, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(up, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(down, ActorAccessor.Y, 1f).target(-Gdx.graphics.getHeight())) .push(Tween.to(descend, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rx, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(ry, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(rz, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(pause, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(cam, ActorAccessor.Y, 1.25f).target(-Gdx.graphics.getHeight())) .push(Tween.to(quit, ActorAccessor.Y, 1.15f).target(-Gdx.graphics.getHeight())) .push(Tween.to(question, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(scoreLabel, ActorAccessor.Y, 1.5f).target(-Gdx.graphics.getHeight())) .push(Tween.to(textLabel, ActorAccessor.Y, 2.5f).target(-Gdx.graphics.getHeight())).end().setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new GameOver(score,ScoreManager.LEVEL_2,done)); } }).start(tweenManager); }
public static void main(String[] args) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); new LwjglApplication(new Game(){ @Override public void create() { // play a music Music music = Gdx.audio.newMusic(Gdx.files.classpath("cloudconnected.ogg")); music.setVolume(0.3f); music.play(); // and a pd patch at the same time Pd.audio.create(new PdConfiguration()); Pd.audio.open(Gdx.files.local("resources/test.pd")); }}, config); }
public static void main(String[] args) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); new LwjglApplication(new Game(){ @Override public void create() { // play a pd patch Pd.audio.create(new PdConfiguration()); Pd.audio.open(Gdx.files.local("resources/test.pd")); // and sounds at the same time final Sound snd = Gdx.audio.newSound(Gdx.files.classpath("shotgun.wav")); snd.play(); Gdx.input.setInputProcessor(new InputAdapter(){ @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { snd.play(); return true; } }); }}, config); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(); stage.draw(); // done loading if (Assets.update()) { if (phase == 1) { Assets.setSongs(); ((Game) Gdx.app.getApplicationListener()).setScreen(new SettingsScreen()); } if (phase == 0) { phase++; // this will cause any newly created .rs files to be loaded. Assets.reloadBeatmaps(); } } loadingProgress.setValue((Assets.getProgress() - 0.5f)* 200f); loadingProgress.act(delta); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); loadingTime -= delta; if (loadingTime <= 0 && !warnings) { if (valid) { ((Game) Gdx.app.getApplicationListener()).setScreen(new SongScreen()); } } stage.act(); stage.draw(); }
public void init(Game game, Assets assets) { hiScoreBuilder = new StringBuilder(); savedStuff = new SavedStuff(); skin = new Skin(); stage = new Stage(); batch = new SpriteBatch(); cam = new OrthographicCamera(MainMenuScreen.WIDTH, MainMenuScreen.HEIGHT); Gdx.input.setInputProcessor(stage); stage.setViewport(new StretchViewport(MainMenuScreen.WIDTH, MainMenuScreen.HEIGHT)); batch.setProjectionMatrix(cam.combined); this.game = game; this.assets = assets; loadMainMenuAssets(); setUpSkin(); createTable(); createStageActors(); addStageActorsToStage(); setActorsToDefaults(); addListenersToActors(); }
/** * Build a new TextButton with factory default button style * * @param context * a Game context where * @param label * string button's label * @param nextScreenAfterClick * the next screen that will be showed after button click * @return a new TextButton ready to be added to a stage */ public TextButton makeMenuButton(final Game game, final String label, final Screen nextScreenAfterClick) { button = new TextButton(label, textButtonStyle); button.setHeight(menuItemHeight); button.setWidth(menuItemWidth); button.setPosition(initPosXMenu, initPosYMenu - menuItemHeight * menuItemNumber); menuItemNumber++; button.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Assets.playSound(Assets.clickSound); game.getScreen().dispose(); game.setScreen(nextScreenAfterClick); } }); return button; }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (animation.isAnimationFinished(deltaAccumulator)){ ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); } else { deltaAccumulator += delta; textureCurrentFrame = animation.getKeyFrame(deltaAccumulator, true); } batch.begin(); batch.draw(textureCurrentFrame, 0, 0, width, height); batch.end(); }
public GameScreen (Game g) { game = g; json = new Json(); // New all the objects. board = new Board(); controller = new Controller(); floater = new Floater(MAKE_NEW); renderer = new Renderer(); assets = new Assets(); audio = new Audio(); savedStuff = new SavedStuff(); savedStuff.loadScores(); savedStuff.loadPreferences(); assets.initGame(); shareObjects(MAKE_NEW); fillBoardWithBlocks(); }
public GameScreen (Game g, boolean loadSavedGame) { game = g; json = new Json(); // load old objects loadGameState(); floater.initObjectsAfterSerialization(); // New some the objects. controller = new Controller(); renderer = new Renderer(); assets = new Assets(); audio = new Audio(); savedStuff = new SavedStuff(); savedStuff.loadScores(); savedStuff.loadPreferences(); assets.initGame(); float timeToDrop = savedStuff.getTimeToDrop(); controller.setTimeToDrop(timeToDrop); shareObjects(DONT_MAKE_NEW); }
public ThirdScreen (Game agame) { game = agame; batch = new SpriteBatch(); img = new Texture("aklu.jpg"); shapeRenderer = new ShapeRenderer(); centerCircle = new Circle(); leftCircle = new Circle(); rightCircle = new Circle(); myTouch = new Circle(); camera = new OrthographicCamera(); camera.setToOrtho(false, 800, 400); colorChanger = 0; counter = 0; }
public secondScreen (Game agame) { game = agame; batch = new SpriteBatch(); img = new Texture("aklu.jpg"); shapeRenderer = new ShapeRenderer(); centerCircle = new Circle(); leftCircle = new Circle(); rightCircle = new Circle(); myTouch = new Circle(); camera = new OrthographicCamera(); camera.setToOrtho(false, 800, 400); colorChanger = 0; counter = 0; }
private void receive() { while (true) { try { String str = reader.readLine(); try { map = Level.load(str, players); map.sort(); Gdx.app.postRunnable(() -> { MatchScreen matchScreen = new MatchScreen(new Match(Client.this, player)); ((Game) Gdx.app.getApplicationListener()).setScreen(matchScreen); }); } catch (Exception e) { try { json.fromJson(Packet.class, str); } catch (Exception e2) { if (str.equals("refresh")) { for (int i = 0; i < map.size; i++) { map.get(i).update(); } } else if (str.contains(":")) { Hud.getTimer().setText(str); } else { player.setId(Integer.parseInt(str)); players.put(player.getId(), player); } } } } catch (IOException io) { io.printStackTrace(); } } }
@Override public void show() { stage = new Stage(); Gdx.input.setInputProcessor(stage); VisUI.load(); CenteredTableBuilder tableBuilder = new CenteredTableBuilder(new Padding(2, 3)); VisLabel heading = new VisLabel("Credits"); heading.setColor(Color.BLACK); tableBuilder.append(heading).row(); stage.addActor(heading); VisLabel temp = new VisLabel("To Be Implemented"); temp.setColor(Color.BLACK); tableBuilder.append(temp).row(); stage.addActor(temp); VisTextButton backButton = new VisTextButton("Back"); backButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen()); } }); tableBuilder.append(backButton).row(); stage.addActor(backButton); Table table = tableBuilder.build(); table.setFillParent(true); stage.addActor(table); }
@Override public void show() { stage = new Stage(); Gdx.input.setInputProcessor(stage); VisUI.load(); CenteredTableBuilder tableBuilder = new CenteredTableBuilder(new Padding(2, 3)); VisLabel heading = new VisLabel("Options"); heading.setColor(Color.BLACK); tableBuilder.append(heading).row(); stage.addActor(heading); VisLabel temp = new VisLabel("To Be Implemented"); temp.setColor(Color.BLACK); tableBuilder.append(temp).row(); stage.addActor(temp); VisTextButton backButton = new VisTextButton("Back"); backButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen()); } }); tableBuilder.append(backButton).row(); stage.addActor(backButton); Table table = tableBuilder.build(); table.setFillParent(true); stage.addActor(table); }
/** * Entry point. */ public static void main(String[] args) { Game game = new GameMain(); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.fullscreen = false; config.width = 960; config.height = 720; config.resizable = false; config.title = GameMain.GAME_TITLE; config.addIcon("resources/icon32.png", FileType.Internal); lwjglApplication = new LwjglApplication(game, config); }
public GameScreen(Game game, int score, boolean isRelife) { Box2D.init(); SCORE = score; this.isRelife = isRelife; preferences = new GamePreferences(); audioManager = AudioManager.getInstance(); aGame = game; stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT)); world = WorldUtils.createWorld(); world.setContactListener(this); FlappySpinner.gameManager.changeBackgroundColor("#e9fcd9"); Gdx.input.setInputProcessor(stage); state = GameState.RESUME; setUpBackground(); setUpTube(); setUpSpinner(); setUpGround(); setUpOnPause(); setUpOnResume(); setUpOnFinish(); setUpButtons(); setUpLabels(); }
public StoryScreenController(Game game) { super(game, Constants.WIDTH, Constants.HEIGHT); Gdx.input.setCatchBackKey(true); if (((MerlinGame) game).currentPhase != -1) { int currentFirstLevel = ((MerlinGame) game).currentFirstLevel; selectPhase(((MerlinGame) game).currentPhase); move(currentFirstLevel); this.mode = MODE_LEVEL; } else { this.mode = MODE_PHASE; } }
public Screens(final Game game, final Client client,final Server server) { this.game = game; this.server = server; this.client = client; if(client == null || server == null) { throw new NullPointerException("Server or Client object are empty!"); } }
public Driver(Game game) { debugMatrix = new Matrix4(); debugRenderer = new Box2DDebugRenderer(); spriteBatch = new SpriteBatch(); Gdx.app.setLogLevel(Globals.LOG_LEVEL); }
public MainMenu(Game game) { this.game = game; stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf")); skin = new Skin(Gdx.files.internal("uiskin.json")); }
@Override public boolean keyUp(int keycode) { if (!GlobalKeyHandler.keyUp(keycode)) { ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); } return false; }
public VisualEditor(Game game, Screen previousScreen) { this.game = game; this.previousScreen = previousScreen; this.instances = new ArrayList<>(); this.gameWorld = GameWorldFactory.worldObjectWorld(this.instances); this.editor = new ShaderEditor(this.gameWorld); }
@Override public void show() { //initialize sprite batch batch = new SpriteBatch(); //initialize splash sprite splash = new Sprite(TextureLoader.getSplash()); //set splash size splash.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); //setup animation tween = new TweenManager(); Tween.registerAccessor(Sprite.class, new SpriteAccessor()); //FadeIN Tween.set(splash,SpriteAccessor.ALPHA).target(0).start(tween); Tween.to(splash,SpriteAccessor.ALPHA,1.5f).target(1).start(tween); //FadeOut Tween.to(splash,SpriteAccessor.ALPHA,2f).target(0).delay(1.25f).setCallback(new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { ((Game)Gdx.app.getApplicationListener()).setScreen(new MainMenu()); } }).start(tween); }