List of usage examples for com.badlogic.gdx.utils.viewport FitViewport FitViewport
public FitViewport(float worldWidth, float worldHeight)
From source file:com.mygdx.game.CreditsScreen.java
License:GNU General Public License
public CreditsScreen(final com.mygdx.game.MainGame game) { super(game);//from w w w .j a v a2 s . co m stage = new Stage(new FitViewport(640, 360)); skin = new Skin(Gdx.files.internal("skin/uiskin.json")); back = new TextButton("Atras", skin); credits = new Label("BucketChallenge v1.0\n" + "Copyright (C) 2016-2017 Sufy Saguer\n" + "This game is GNU GPL. Get the code at github.com/5uf1nh0/BucketChallenge\n\n" + "Licensed under Creative Commons: By Attribution 3.0", skin); back.addCaptureListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { // Take me to the game screen! game.setScreen(game.menuScreen); } }); credits.setPosition(20, 340 - credits.getHeight()); back.setSize(200, 80); back.setPosition(40, 50); stage.addActor(back); stage.addActor(credits); }
From source file:com.lazyrunner.CreditosScreen.java
License:LGPL
public CreditosScreen(final LazyRunner game) { super(game);/* w w w. j av a2s . co m*/ stage = new Stage(new FitViewport(640, 360)); skin = new Skin(Gdx.files.internal("uiskin.json")); back = new TextButton("Back", skin); creditos = new Label("Lazy Runner v1.0.0\n" + "Copyright(C) 2016-2017 Emmanuel Guerra.\n" + "CC BY-NC-SA 4.0.\n" + "Art:\n" + "Floor: White Stone Tile Floor by Tiziana.\n" + "License: LGPL 2.1, LGPL 3.0, CC-BY 3.0\n" + "Background: Background-Canterlot High Hallway by knightwolf09.\n" + "Music:\n" + "Background music: Jump and Run(8-Bit) by bart.\n" + "(https://goo.gl/1M6gHj)\n" + "License: CC-BY 3.0.\n" + "Jump sound: Platformer Jumping Sounds by dklon.\n" + "License: CC-BY 3.0.\n", skin); back.addCaptureListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { // De vuelta al men. game.setScreen(game.menu); } }); creditos.setPosition(20, 340 - creditos.getHeight()); back.setSize(200, 60); back.setPosition(40, 10); stage.addActor(back); stage.addActor(creditos); }
From source file:GameWorld.Game.GameMap.java
public GameMap(GameWorld gameWorld) { mapStage = new Stage(new FitViewport(Constants.APP_WIDTH * 4, Constants.APP_HEIGHT * 4)); player = new ClearObject(Constants.RUNNER_X, Constants.RUNNER_Y, Constants.RUNNER_WIDTH, Constants.RUNNER_HEIGHT, AssetLoader.btn); mapStage.addActor(player);/*from w w w . j a v a 2 s . c o m*/ }
From source file:halive.shootinoutside.menu.LoadingScreen.java
private void init() { float h = Gdx.graphics.getHeight(); float w = Gdx.graphics.getWidth(); stage = new Stage(new FitViewport(w, h)); skin = UIConstants.Menues.loadSkin(); Table table = new Table(skin); statusLabel = new Label("Loading...", skin); table.add(statusLabel).padBottom(UIConstants.Menues.PADDING_BOTTOM).row(); progressBar = new ProgressBar(0.0f, 100.0f, 0.1f, false, skin, "default"); table.add(progressBar).size(500, 80).row(); table.setFillParent(true);/*from w ww. j ava2 s .c om*/ stage.addActor(table); }
From source file:th.skyousuke.flappybird.Hud.java
License:Apache License
public Hud() { stage = new Stage(new FitViewport(FlappyBirdJeanDang.SCENE_WIDTH, FlappyBirdJeanDang.SCENE_HEIGHT)); Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = Assets.instance.font; labelStyle.fontColor = Color.BLACK; startLabel = new Label( "?\n? F1 / Debug", labelStyle);/* w w w . ja v a 2 s. co m*/ startLabel.setAlignment(Align.center); startLabel.setPosition(FlappyBirdJeanDang.SCENE_WIDTH / 2 - startLabel.getWidth() / 2, 480); scoreLabel = new Label("?: 0", labelStyle); scoreLabel.setPosition(FlappyBirdJeanDang.SCENE_WIDTH / 2 - scoreLabel.getWidth() / 2, 550); scoreLabel.setVisible(false); fpsLabel = new Label("", labelStyle); fpsLabel.setPosition(5, 10); fpsLabel.addAction(Actions.forever(Actions.delay(1, new Action() { @Override public boolean act(float delta) { fpsLabel.setText("FPS: " + Gdx.graphics.getFramesPerSecond()); return true; } }))); stage.addActor(fpsLabel); stage.addActor(startLabel); stage.addActor(scoreLabel); }
From source file:com.gmail.emersonmx.tictactoe.BaseScreen.java
License:Open Source License
protected void setup() { Viewport viewport = new FitViewport(TicTacToe.WINDOW_WIDTH, TicTacToe.WINDOW_HEIGHT); OrthographicCamera camera = (OrthographicCamera) viewport.getCamera(); camera.setToOrtho(false, TicTacToe.WINDOW_WIDTH, TicTacToe.WINDOW_HEIGHT); Gdx.gl.glClearColor(0, 0, 0, 1);//from w w w . j a va 2 s .c o m stage = new Stage(viewport); Gdx.input.setInputProcessor(stage); }
From source file:com.gmail.emersonmx.asteroids.screen.BaseScreen.java
License:Open Source License
private void createViewport() { viewport = new FitViewport(Space.WIDTH, Space.HEIGHT); }
From source file:es.danirod.jumpdontdie.game.LoadingScreen.java
License:Open Source License
public LoadingScreen(MainGame game) { super(game);/* w ww . j av a 2s . c o m*/ // Set up the stage and the skin. See GameOverScreen for more comments on this. stage = new Stage(new FitViewport(640, 360)); skin = new Skin(Gdx.files.internal("skin/uiskin.json")); // Create some loading text using this skin file and position it on screen. loading = new Label("Loading...", skin); loading.setPosition(320 - loading.getWidth() / 2, 180 - loading.getHeight() / 2); stage.addActor(loading); }
From source file:es.danirod.jddprototype.game.CreditsScreen.java
License:Open Source License
public CreditsScreen(final es.danirod.jddprototype.game.MainGame game) { super(game);/*from w w w .ja va 2 s.c om*/ // Create a new stage, as usual. stage = new Stage(new FitViewport(640, 360)); // Load the skin file. The skin file contains information about the skins. It can be // passed to any widget in Scene2D UI to set the style. It just works, amazing. skin = new Skin(Gdx.files.internal("skin/uiskin.json")); // For instance, here you see that I create a new button by telling the label of the // button as well as the skin file. The background image for the button is in the skin // file. back = new TextButton("Back", skin); credits = new Label("Jump Don't Die v1.0.2\n" + "Copyright (C) 2015-2016 Dani Rodriguez\n" + "This game is GNU GPL. Get the code at github.com/danirod/JumpDontDie\n\n" + "Music: \"Long Time Coming\" Kevin MacLeod (incompetech.com)\n" + "Licensed under Creative Commons: By Attribution 3.0", skin); // Add capture listeners. Capture listeners have one method, changed, that is executed // when the button is pressed or when the user interacts somehow with the widget. They are // cool because they let you execute some code when you press them. back.addCaptureListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { // Take me to the game screen! game.setScreen(game.menuScreen); } }); // Now I position things on screen. Sorry for making this the hardest part of this screen. // I position things on the screen so that they look centered. This is why I make the // buttons the same size. credits.setPosition(20, 340 - credits.getHeight()); back.setSize(200, 80); back.setPosition(40, 50); // Do not forget to add actors to the stage or we wouldn't see anything. stage.addActor(back); stage.addActor(credits); }
From source file:es.danirod.jddprototype.game.LoadingScreen.java
License:Open Source License
public LoadingScreen(es.danirod.jddprototype.game.MainGame game) { super(game);/*from ww w . ja v a 2 s.c o m*/ // Set up the stage and the skin. See GameOverScreen for more comments on this. stage = new Stage(new FitViewport(640, 360)); skin = new Skin(Gdx.files.internal("skin/uiskin.json")); // Create some loading text using this skin file and position it on screen. loading = new Label("Loading...", skin); loading.setPosition(320 - loading.getWidth() / 2, 180 - loading.getHeight() / 2); stage.addActor(loading); }