List of usage examples for com.badlogic.gdx.utils.viewport FitViewport FitViewport
public FitViewport(float worldWidth, float worldHeight, Camera camera)
From source file:dk.sdu.core.screens.GameOverScreen.java
public GameOverScreen() { viewport = new FitViewport(Game.V_WIDTH, Game.V_HEIGHT, new OrthographicCamera()); stage = new Stage(viewport); Label.LabelStyle font = new Label.LabelStyle(new BitmapFont(), Color.WHITE); Table table = new Table(); table.center();//from w ww . j a v a 2 s . c o m table.setFillParent(true); Label gameOverLabel = new Label("GAME OVER", font); table.add(gameOverLabel).expandX(); stage.addActor(table); }
From source file:com.Screens.WorldRenderer.java
public WorldRenderer(World w) { world = w;//from w w w.java2 s. c o m camera = new OrthographicCamera(); viewport = new FitViewport(V_WIDTH, V_HEIGHT, camera); batch = new SpriteBatch(); AssetManager.load(); }
From source file:com.gdx.game.scenes.Hud.java
public Hud(SpriteBatch sb) { this.worldTimer = 300; this.timeCount = 0; this.score = 0; this.viewPort = new FitViewport(GdxGame.V_WIDTH, GdxGame.V_HEIGHT, new OrthographicCamera()); this.stage = new Stage(this.viewPort, sb); Table table = new Table(); table.top();/*w w w . ja v a 2s. c om*/ table.setFillParent(true); this.countDownLabel = new Label(String.format("%03d", this.worldTimer), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); this.scoreLabel = new Label(String.format("%06d", this.score), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); this.timeLabel = new Label("TIME", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); this.levelLabel = new Label("1-1", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); this.worldLabel = new Label("WORLD", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); this.charLabel = new Label("char", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); table.add(this.charLabel).expandX().padTop(10); table.add(this.worldLabel).expandX().padTop(10); table.add(this.timeLabel).expandX().padTop(10); table.row(); table.add(this.scoreLabel).expandX(); table.add(this.levelLabel).expandX(); table.add(this.countDownLabel).expandX(); stage.addActor(table); }
From source file:th.skyousuke.flappybird.WorldRenderer.java
License:Apache License
public WorldRenderer(WorldController worldController) { this.worldController = worldController; camera = new OrthographicCamera(); viewport = new FitViewport(FlappyBirdJeanDang.SCENE_WIDTH, FlappyBirdJeanDang.SCENE_HEIGHT, camera); batch = new SpriteBatch(); shapeRenderer = new ShapeRenderer(); shapeRenderer.setColor(Color.RED); }
From source file:com.oceangamejam.game.screens.GameOverScreen.java
public GameOverScreen(FishOver game) { camera = new OrthographicCamera(); this.game = game; batch = new SpriteBatch(); viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera); stage = new Stage(viewport, (game).batch); font = new BitmapFont(); font.getData().setScale(3, 3);// w w w.j ava2 s .c om Label.LabelStyle fontx = new Label.LabelStyle(font, Color.WHITE); Table table = new Table(); table.center(); table.setFillParent(true); Label gameOverLabel = new Label("GAME OVER. " + GameScreen.endMessage, fontx); Label playAgainLabel = new Label("Press Space to Play Again", fontx); table.add(gameOverLabel).expandX(); table.row(); table.add(playAgainLabel).expandX().padTop(10f); stage.addActor(table); }
From source file:dk.sdu.core.scenes.HUD.java
public HUD(SpriteBatch sb) { worldTimer = 300;//from w ww.jav a 2 s . c o m timeCount = 0; score = 0; viewport = new FitViewport(Game.V_WIDTH, Game.V_HEIGHT, new OrthographicCamera()); stage = new Stage(viewport, sb); Table table = new Table(); table.top(); table.setFillParent(true); countdownLabel = new Label(String.format("%03d", worldTimer), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); timeLabel = new Label("TIME", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); levelLabel = new Label("1", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); worldLabel = new Label("LEVEL", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); playerLabel = new Label("SCORE", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); healthLabel = new Label("HEALTH", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); healthCountLabel = new Label(String.format("%03d", playerHealth), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); table.add(playerLabel).expandX().padTop(10); table.add(healthLabel).expandX().padTop(10); table.add(worldLabel).expandX().padTop(10); table.add(timeLabel).expandX().padTop(10); table.row(); table.add(scoreLabel).expandX(); table.add(healthCountLabel).expandX(); table.add(levelLabel).expandX(); table.add(countdownLabel).expandX(); stage.addActor(table); }
From source file:th.skyousuke.libgdx.xomaisad.MainMenuScreen.java
License:Apache License
public MainMenuScreen(final XOMaiSad game) { this.game = game; camera = new OrthographicCamera(); viewport = new FitViewport(XOMaiSad.SCREEN_WIDTH, XOMaiSad.SCREEN_HEIGHT, camera); game.glyphLayout.setText(Assets.instance.font, TITLE_TEXT); titleTextWidth = game.glyphLayout.width; game.glyphLayout.setText(Assets.instance.font, START_TEXT); startTextWidth = game.glyphLayout.width; }
From source file:com.mrlamont.Model.TitleScreen.java
public void render(float delta) { camera = new OrthographicCamera(); viewport = new FitViewport(V_WIDTH, V_HEIGHT, camera); batch = new SpriteBatch(); // clear the screen with black Gdx.gl20.glClearColor(0, 0, 0, 1);/* w w w . j a v a 2s.c o m*/ Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT); g = new ShapeRenderer(); batch = new SpriteBatch(); g.begin(ShapeRenderer.ShapeType.Filled); g.setColor(Color.PURPLE); g.rect(550, 0, 110, 600); g.setColor(Color.BLUE); g.rect(440, 0, 110, 600); g.setColor(Color.GREEN); g.rect(330, 0, 110, 600); g.setColor(Color.YELLOW); g.rect(220, 0, 110, 600); g.setColor(Color.ORANGE); g.rect(110, 0, 110, 600); g.setColor(Color.RED); g.rect(0, 0, 110, 600); g.end(); //draw different coloured Wheelys on screen batch.begin(); batch.draw(AssetManager.wheelyYellow, 190, -1); batch.draw(AssetManager.wheelyOrange, 90, -1); batch.draw(AssetManager.wheelyRed, -14, -1); batch.draw(AssetManager.wheelyGreenL, 320, -1); batch.draw(AssetManager.wheelyBlueL, 420, -1); batch.draw(AssetManager.wheelyPurpleL, 520, -1); batch.end(); //If a certain colour is left clicked, that colouro of Wheely is selected if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) { Vector3 mouseClick = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(mouseClick); System.out.println("x: " + mouseClick.x + " y: " + mouseClick.y); //Red if (mouseClick.y >= -1 && mouseClick.y <= 0.991 && mouseClick.x >= -1 && mouseClick.x <= -0.6625) { red = true; } //Green if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.034374952 && mouseClick.x <= 0.36874998) { green = true; } //Orange if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.653125 && mouseClick.x <= -0.32187498) { orange = true; } //Yellow if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.309375 && mouseClick.x <= 0.024999976) { yellow = true; } //Blue if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.37812495 && mouseClick.x <= 0.7125) { blue = true; } //Purple if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.71875 && mouseClick.x <= 0.99375) { purple = true; } } }
From source file:com.mygdx.game.Tools.Screens.Hud.java
public Hud(int level, int world, SpriteBatch batch) { this.level = level; this.world = world; score = 0;//from w ww . ja v a2 s . c o m lives = 10; viewport = new FitViewport(AdventureGame.V_WIDTH, AdventureGame.V_HEIGHT, new OrthographicCamera()); stage = new Stage(viewport, batch); Table table = new Table(); table.top(); table.setFillParent(true); livesLabel = new Label(String.format("%02d", lives), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); levelLabel = new Label("1-1", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); worldLabel = new Label("WORLD", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); playerscoreLabel = new Label("SCORE", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); playerlivesLabel = new Label("LIVES", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); table.add(worldLabel).expandX().padTop(10); table.add(playerscoreLabel).expandX().padTop(10); table.add(playerlivesLabel).expandX().padTop(10); table.row(); table.add(levelLabel).expandX(); table.add(scoreLabel).expandX(); table.add(livesLabel).expandX(); stage.addActor(table); }
From source file:com.bss.game.HelpScreen.java
License:Apache License
public HelpScreen(MadFishing game) { this.game = game; guiCam = new OrthographicCamera(480, 800); guiCam.position.set(480 / 2, 800 / 2, 0); scaleVP = new FitViewport(480, 800, guiCam); nextBounds = new Rectangle(480 - 150, 100, 150, 100); touchPoint = new Vector3(); helpImage = Assets.loadTexture("help.png"); helpRegion = new TextureRegion(helpImage, 0, 0, 480, 800); }