List of usage examples for com.badlogic.gdx.utils.viewport ScreenViewport ScreenViewport
public ScreenViewport()
From source file:edu.franklin.practicum.f15.strategygame.gui.GameLoadingScreen.java
public GameLoadingScreen(StrategyGame inGame) { this.game = inGame; this.font = game.font; this.batch = game.batch; stage = new Stage(new ScreenViewport()); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Texture tex = new Texture(Gdx.files.internal("ui/game_loading.png")); background = new Sprite(tex); background.scale(1.0f);//from w w w . jav a2 s . c o m background.setPosition((Gdx.graphics.getWidth() - background.getWidth()) / 2, (Gdx.graphics.getHeight() - background.getHeight()) / 2); }
From source file:com.quadbits.gdxhelper.screens.LWPScreenModule.java
License:Apache License
@Provides
@PerGameScreen
LWPStage provideLWPStage() {
LWPStage stage = new LWPStage();
stage.setViewport(new ScreenViewport());
return stage;
}
From source file:com.uwsoft.editor.gdx.stage.BaseStage.java
License:Apache License
public BaseStage() { super(new ScreenViewport()); dataManager = DataManager.getInstance(); textureManager = dataManager.textureManager; initLightsConfiguration(); }
From source file:com.prisonbreak.game.screens.IntroScreen.java
public IntroScreen(Game aGame) { game = aGame;//from w w w . ja v a 2s . c o m stage = new Stage(new ScreenViewport()); // add background image Image backgroundImage = new Image(new Texture(Gdx.files.internal("background.jpg"))); backgroundImage.setSize(PrisonBreakGame.BACKGROUND_WIDTH, PrisonBreakGame.BACKGROUND_HEIGHT); backgroundImage.setPosition(0, 0); stage.addActor(backgroundImage); // add title Label.LabelStyle labelStyle = new Label.LabelStyle(); BitmapFont myFont = new BitmapFont(Gdx.files.internal("font/Octin-Prison-80.fnt")); labelStyle.font = myFont; labelStyle.fontColor = Color.WHITE; Label title = new Label("PRISON BREAK", labelStyle); title.setPosition(Gdx.graphics.getWidth() / 2 - title.getWidth() / 2, Gdx.graphics.getHeight() * 2 / 3 - title.getHeight() / 2); title.setAlignment(Align.center); stage.addActor(title); // create label for displaying instructions to play the game String instructions = "Use arrow keys or W S D A to move the character.\n" + "Press F to interact with objects.\nPress I to show/hide player's inventory.\n\n" + "Go around and find the necessary items and information to get out.\n" + "Remember, avoid the security guards at all cost. Good luck, prisoner!\n\n" + "Press ENTER to play the game."; instruct = new Label(instructions, PrisonBreakGame.gameSkin, "custom"); instruct.setPosition(Gdx.graphics.getWidth() / 6, Gdx.graphics.getHeight() / 6); instruct.setSize(Gdx.graphics.getWidth() * 2 / 3, Gdx.graphics.getHeight() * 2 / 3); instruct.setAlignment(Align.left); instruct.setWrap(true); instruct.addListener(new InputListener() { @Override public boolean keyDown(InputEvent event, int keycode) { if (keycode == Input.Keys.ENTER) { instruct.remove(); dispose(); game.setScreen(new GameScreen(game)); return true; } else { return false; } } }); // create "Play" button TextButton playButton = new TextButton("Play", PrisonBreakGame.gameSkin, "round"); playButton.setWidth(Gdx.graphics.getWidth() / 4); playButton.setPosition(Gdx.graphics.getWidth() / 2 - playButton.getWidth() / 2, Gdx.graphics.getHeight() / 2 - playButton.getHeight() / 2); playButton.addListener(new InputListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { // dispose(); // game.setScreen(new GameScreen(game)); stage.addActor(instruct); stage.setKeyboardFocus(instruct); } @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } }); stage.addActor(playButton); // create "Exit" button TextButton exitButton = new TextButton("Exit", PrisonBreakGame.gameSkin, "round"); exitButton.setWidth(Gdx.graphics.getWidth() / 4); exitButton.setPosition(Gdx.graphics.getWidth() / 2 - exitButton.getWidth() / 2, Gdx.graphics.getHeight() * 2 / 5 - exitButton.getHeight() / 2); exitButton.addListener(new InputListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { System.exit(0); } @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } }); stage.addActor(exitButton); }
From source file:ru.kvachenko.stoneclicker.screens.LoadingScreen.java
License:Open Source License
public LoadingScreen() { mainStage = new Stage(new ScreenViewport()); //loadingImage = new Image(new Texture(Gdx.files.internal("android/assets/images/loading.png"))); loadingImage = new Image(new Texture(Gdx.files.internal("images/loading.png"))); mainStage.addActor(loadingImage);//from w w w .ja va2s . co m }
From source file:se.angergard.game.util.BasicGUI.java
License:Apache License
public void init() { stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage);/* w ww. j a v a 2 s . c o m*/ mainTable = new Table(); mainTable.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); stage.addActor(mainTable); font = new BitmapFont(Gdx.files.internal("font2.fnt")); blueTextButtonStyle = new TextButtonStyle(); blueTextButtonStyle.up = TextureUtils.createDrawable(new Color(52f / 255f, 73f / 255f, 94f / 255f, 1.0f), 300, 75); blueTextButtonStyle.down = TextureUtils.createDrawable(new Color(44f / 255f, 62f / 255f, 80f / 255f, 1.0f), 300, 75); blueTextButtonStyle.over = TextureUtils.createDrawable(new Color(60f / 255f, 84f / 255f, 108f / 255f, 1.0f), 300, 75); blueTextButtonStyle.font = font; blueTextButtonStyle.fontColor = Color.BLACK; labelStyle = new LabelStyle(); labelStyle.background = blueTextButtonStyle.up; labelStyle.font = font; labelStyle.fontColor = Color.WHITE; }
From source file:com.mbrlabs.mundus.editor.ui.widgets.RenderWidget.java
License:Apache License
public RenderWidget() { super(); viewport = new ScreenViewport(); }
From source file:free.hacknet.game.LoginMenuScreen.java
License:Open Source License
public LoginMenuScreen() { stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage);//from w w w . j a va 2s .c o m LoadFreeTypeFont(); skin = new Skin(Gdx.files.internal("data/uiskin.json")); Table table = new Table(); table.setFillParent(true); table.debug(); Label namelabel = new Label("Login:", skin); TextField nameText = new TextField("", skin); nameText.setTextFieldListener(new TextFieldListener() { @Override public void keyTyped(TextField textField, char c) { if (c == '\n') textField.getOnscreenKeyboard().show(false); } }); Label passlabel = new Label("Password:", skin); TextField passtext = new TextField("", skin); table.add(namelabel); table.add(nameText).width(200); table.row(); table.add(passlabel); table.add(passtext).width(200); fpsLabel = new Label("fps:", skin); stage.addActor(table); stage.addActor(fpsLabel); }
From source file:com.uwsoft.editor.view.stage.UIStage.java
License:Apache License
public UIStage() { super(new ScreenViewport()); facade = Overlap2DFacade.getInstance(); //dummy target is basically the target of drop of items from resoruce panel dummyTarget = new Group(); dummyTarget.setWidth(getWidth());/*from w ww.j a va 2 s .c om*/ dummyTarget.setHeight(getHeight()); dummyTarget.setY(0); dummyTarget.setX(0); addActor(dummyTarget); midUI = new Group(); addActor(midUI); RulersUIMediator rulersUIMediator = facade.retrieveMediator(RulersUIMediator.NAME); Actor rulersGroup = rulersUIMediator.getViewComponent(); FollowersUIMediator followersUIMediator = facade.retrieveMediator(FollowersUIMediator.NAME); Group followersGroup = followersUIMediator.getViewComponent(); midUI.addActor(followersGroup); midUI.addActor(rulersGroup); contextMenuContainer = new Group(); uiMainTable = new UIMainTable(); addActor(uiMainTable); addActor(contextMenuContainer); setListeners(); }
From source file:com.agateau.pixelwheels.enginelab.EngineLabScreen.java
License:Apache License
public EngineLabScreen() { super(new ScreenViewport()); setupEngineLab(); UiAssets assets = new UiAssets(); mSkin = assets.skin; setupUi(); }