@Override public void start() { finishedLoading = false; stage = new Stage(new ScreenViewport()); skin = createSkin(); Image image= new Image(skin, "bg"); image.setScaling(Scaling.stretch); image.setFillParent(true); stage.addActor(image); root = new Table(); root.setFillParent(true); stage.addActor(root); progressBar = new ProgressBar(0, 1, .01f, false, skin); progressBar.setAnimateDuration(.1f); root.add(progressBar).growX().expandY().pad(20.0f); }
public UiStage(){ OrthographicCamera _uiCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.setViewport(new ScreenViewport(_uiCamera)); // create skin // root table _rootTable = createRootTable(); createErrorMessagePanel(); uiPanel = new UIPanel(Assets._skin); _rootTable.add(uiPanel) .align(Align.center) .fill(true , true) .minWidth(uiPanel.getLeftSection().getPrefWidth() + uiPanel.getMidSection().getPrefWidth() + uiPanel.getRightSection().getPrefWidth() + 50); // align stuff _rootTable.align(Align.bottom); // add root table to stage this.addActor(_rootTable); _pauseWindow = new PauseWindow("Pause", Assets._skin); _pauseWindow.setSize(Gdx.graphics.getWidth() , Gdx.graphics.getHeight()); this.addActor(_pauseWindow); this.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); }
private void initLoseStage() { setViewport(new ScreenViewport(getCamera())); getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); getViewport().apply(true); Label youLoseLbl = new Label("You lost" , Assets._skin , "fontVeraBd24" ,"white"); playAgainBtn = new TextButton("Play Again", Assets._skin , "menu"); mainMenuBtn = new TextButton("Main Menu", Assets._skin , "menu"); Table container = new Table(Assets._skin); youLoseLbl.setColor(Color.RED); container.add(youLoseLbl).spaceBottom(100).row(); container.add(playAgainBtn).align(Align.left).spaceBottom(20).row(); container.add(mainMenuBtn).align(Align.left); container.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); container.setFillParent(true); addActor(container); }
private void initWinStage() { setViewport(new ScreenViewport(getCamera())); getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); getViewport().apply(true); Label youWinLabel = new Label("You Won!" , Assets._skin , "fontVeraBd24" , "white"); playAgainBtn = new TextButton("Play Again", Assets._skin , "menu"); mainMenuBtn = new TextButton("Main Menu", Assets._skin , "menu"); Table container = new Table(Assets._skin); youWinLabel.setColor(Color.GREEN); container.add(youWinLabel).spaceBottom(100).row(); container.add(playAgainBtn).align(Align.left).spaceBottom(20).row(); container.add(mainMenuBtn).align(Align.left); container.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); container.setFillParent(true); addActor(container); }
public MenuScreen(MainGameClass game) { this.game = game; stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json")); progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class); TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection")); tiledDrawable.setMinWidth(0); progressBarStyle.knobBefore = tiledDrawable; sliderStyle = skin.get("fancy", Slider.SliderStyle.class); sliderStyle.knobBefore = tiledDrawable; layoutTable = new Table(); layoutTable.top(); layoutTable.setFillParent(true); layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50)); }
public DungeonScreen(final PMD game) { //init rendering stuff first this.game = game; this.batch = game.batch; this.skin = new Skin(Gdx.files.internal("ui/skin/flat-earth-ui.json")); sRenderer = new ShapeRenderer(); this.renderList = new Array<RenderComponent>(); cameraBounds = new Rectangle(); gameCamera = new OrthographicCamera(Gdx.graphics.getWidth() / PPM, Gdx.graphics.getHeight() / PPM); gamePort = new ScreenViewport(gameCamera); gamePort.setUnitsPerPixel(1 / PPM); //init stuff for updating controller = new Controller(this); tileBoard = controller.floor.tileBoard; bFont = new BitmapFont(Gdx.files.internal("ui/myCustomFont.fnt")); bFont.getData().setScale(.5f); hud = new Hud(controller, skin, batch); pauseMenu = new PauseMenu(controller, skin, batch); }
public MenuScreen(String menuTitle) { this.camera = new OrthographicCamera(); camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.stage = new Stage(new ScreenViewport(camera)); table = new Table(); table.setFillParent(true); table.defaults().expand().fill().pad(0); skin = Utils.UI_SKIN; table.setBackground(skin.getDrawable("menu-background")); title = new Label(menuTitle, skin, "large"); title.setAlignment(Align.center); table.add(title).padTop(275).colspan(2).row(); stage.addActor(table); // stage.setDebugAll(true); }
@Override public void create () { Gdx.app.log("ShapeClearGame", "create()"); Localize.setLanguage(Locale.getDefault()); AssetLoader.load(); viewport=new ScreenViewport(); stage=new Stage(viewport); background=new Background(); fpsCounter=new FPSCounter(); resize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); mainMenu=new MainMenu(this); gameScreen=new GameScreen(this); setScreen(mainMenu); }
public MainScreen(SkinEditorGame game) { this.game = game; barMenu = new MenuBar(game); barWidgets = new WidgetsBar(game); panePreview = new PreviewPane(game, this); paneOptions = new OptionsPane(game, panePreview); CB_SpriteBatch batch = new CB_SpriteBatch(CB_SpriteBatch.Mode.NORMAL); stage = new Stage(new ScreenViewport(),batch); Table table = new Table(); table.setFillParent(true); table.top().left().add(barMenu).expandX().fillX().colspan(2).row(); table.top().left().add(barWidgets).expandX().fillX().colspan(2).row(); table.top().left().add(paneOptions).width(420).left().fill().expandY(); ScrollPane scrollPane = new ScrollPane(panePreview); table.add(scrollPane).fill().expand(); stage.addActor(table); barWidgets.initializeButtons(); }
public Gui(SpriteAnimator spriteAnimator) { super(new ScreenViewport()); style = new Label.LabelStyle(font, Color.BLACK); frameSpeed = new Label("", style); frameSpeed.setPosition(1f, 10f); updateFrameSpeed(spriteAnimator.getFrameSpeed()); addActor(frameSpeed); frames = new Label("", style); frames.setPosition(1f, 25f); updateFrames(spriteAnimator.getFrames()); addActor(frames); row = new Label("", style); row.setPosition(1f, 40f); updateRow(spriteAnimator.getRow()); addActor(row); zoomLevel = new Label("", style); zoomLevel.setPosition(1f, 55f); updateZoom(spriteAnimator.getZoom()); addActor(zoomLevel); }
/** * @param path - the path to the skin */ public RavUI (String path) { if (!VisUI.isLoaded()) if(path.length() > 0) VisUI.load(path); else VisUI.load(); screenStage = new Stage(new ScreenViewport()); debugConsole = new DebugConsole(); RavTech.input.addInputProcessor(screenStage); screenStage.addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int key) { if (key == Keys.F1) debugConsole.toggleVisible(); return true; } }); screenStage.addActor(debugConsole); }
public HUD() { score = -1; Table table = new Table(); table.top(); table.setFillParent(true); //viewport = new ScreenViewport(FlappyDemo.WIDTH, FlappyDemo.HEIGHT, new OrthographicCamera()); viewport = new ScreenViewport(new OrthographicCamera()); scoreLabel = new Label(String.format("%d", score), new Label.LabelStyle(new BitmapFont(), Color.BLACK)); stage = new Stage(viewport); table.add(scoreLabel).expandX().padTop(10); // You can use table.row(); to create a new row stage.addActor(table); }
public void init(){ stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); 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; }
@Override public void create() { engine = new ExamplesEngine(); entitas = new Entitas(); preferencesManager.LOG_LEVEL = LogManager.LOG_DEBUG; AssetManager assetsManager = new AssetManager(new TestFileHandleResolver()); engine.addManager(new AssetsManagerGDX(assetsManager, preferencesManager)); engine.addManager(new PhysicsManagerGDX(new Vector2(0,-9.8f))); engine.addManager(new GUIManagerGDX(new ScreenViewport(),new BitmapFont(), engine)); engine.addManager(new SceneManagerGDX(engine, entitas)); engine.addManager(new LogManagerGDX(preferencesManager)); engine.addManager(new InputManagerGDX(entitas, engine)); engine.addManager(preferencesManager); game = new ExamplesGame(engine, new EventBusGDX(new MBassador())); game.init(); game.pushState(new PlatformExampleState(engine, entitas)); }
@Override public void show() { iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE); renderer = new ShapeRenderer(); renderer.setAutoShapeType(true); // TODO: Initialize the HUD viewport hudViewport = new ScreenViewport(); // TODO: Initialize the SpriteBatch batch = new SpriteBatch(); // TODO: Initialize the BitmapFont font = new BitmapFont(); // TODO: Give the font a linear TextureFilter font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); player = new Player(iciclesViewport); icicles = new Icicles(iciclesViewport); // TODO: Set top score to zero topScore = 0; }
@Override public void show() { iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE); renderer = new ShapeRenderer(); renderer.setAutoShapeType(true); hudViewport = new ScreenViewport(); batch = new SpriteBatch(); font = new BitmapFont(); font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); player = new Player(iciclesViewport); // TODO: Initialize icicles with the difficulty icicles = new Icicles(iciclesViewport); topScore = 0; }
@Override public void show() { iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE); renderer = new ShapeRenderer(); renderer.setAutoShapeType(true); hudViewport = new ScreenViewport(); batch = new SpriteBatch(); font = new BitmapFont(); font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); player = new Player(iciclesViewport); icicles = new Icicles(iciclesViewport, difficulty); Gdx.input.setInputProcessor(this); topScore = 0; }
/** * Uncomment the following viewports one at a time, and check out the effect when you resize the desktop window. */ @Override public void create() { camera = new OrthographicCamera(); // Makes the size of the world match the size of the screen viewport = new ScreenViewport(camera); // Make the world fill the screen, regardless of aspect ratio // viewport = new StretchViewport(WORLD_WIDTH, WORLD_HEIGHT, camera); // Make the world fill the screen, maintaining aspect ratio, but bits of the world may be cut off // viewport = new FillViewport(WORLD_WIDTH, WORLD_HEIGHT, camera); // Fit the world inside the screen, adding black bars to pad out the extra space, maintaining aspect ratio // viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT, camera); // Make the short axis of the world larger to fill the screen, maintaining aspect ratio // viewport = new ExtendViewport(WORLD_WIDTH, WORLD_HEIGHT, camera); viewport.setScreenBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); renderer = new ShapeRenderer(); }
@Override public void show() { iciclesViewport = new ExtendViewport(Constants.WORLD_SIZE, Constants.WORLD_SIZE); renderer = new ShapeRenderer(); renderer.setAutoShapeType(true); hudViewport = new ScreenViewport(); batch = new SpriteBatch(); font = new BitmapFont(); font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); player = new Player(iciclesViewport); // TODO: Initialize icicles with the difficulty icicles = new Icicles(iciclesViewport, difficulty); topScore = 0; }
private void create() { skin = Global.loadSkin(); stage = new Stage( new ScreenViewport() ); batch = new SpriteBatch(); Table table = new Table(); label = new Label( "Loading", skin, "title" ); progressBar = new ProgressBar( 0, 100, 1, false, skin ); table.add( progressBar ).expand().fillX().bottom().pad( 20 ); table.row(); table.add( label ).expand().top().pad( 20 ); table.setFillParent( true ); stage.addActor( table ); }
public void create() { skin = Global.loadSkin(); stage = new Stage( new ScreenViewport() ); batch = new SpriteBatch(); table = new Table(); stage.addActor( table ); table.setFillParent( true ); inputMultiplexer = new InputMultiplexer(); InputProcessor inputProcessorOne = this; InputProcessor inputProcessorTwo = stage; inputMultiplexer.addProcessor( inputProcessorTwo ); inputMultiplexer.addProcessor( inputProcessorOne ); }
private void LoadUI() { skin = Global.loadSkin(); stage = new Stage( new ScreenViewport() ); abilityPanel = new AbilityPanel( skin, stage ); equipmentPanel = new EquipmentPanel( skin, stage ); buttonsPanel = new ButtonsPanel( skin, stage ); stage.addActor( abilityPanel ); stage.addActor( equipmentPanel ); stage.addActor( abilityPanel ); stage.addActor( buttonsPanel ); relayoutUI(); }
@Override public void create() { Gdx.app.log("MyGdxGame", "create()"); assets.load(); assets.am.finishLoading(); stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); graphActor = new GraphActor(); listActor = new ListActor(interpolators, assets) { @Override public void onSelectedInterpolator(Interpolator interpolator) { Gdx.app.log("MyGdxGame", "onSelectedInterpolator: " + interpolator.getClass().getSimpleName()); graphActor.setInterpolator(interpolator); } }; stage.addActor(listActor); stage.addActor(graphActor); }
static public Array<Viewport> getViewports (Camera camera) { int minWorldWidth = 640; int minWorldHeight = 480; int maxWorldWidth = 800; int maxWorldHeight = 480; Array<Viewport> viewports = new Array(); viewports.add(new StretchViewport(minWorldWidth, minWorldHeight, camera)); viewports.add(new FillViewport(minWorldWidth, minWorldHeight, camera)); viewports.add(new FitViewport(minWorldWidth, minWorldHeight, camera)); viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, camera)); viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, maxWorldWidth, maxWorldHeight, camera)); viewports.add(new ScreenViewport(camera)); ScreenViewport screenViewport = new ScreenViewport(camera); screenViewport.setUnitsPerPixel(0.75f); viewports.add(screenViewport); viewports.add(new ScalingViewport(Scaling.none, minWorldWidth, minWorldHeight, camera)); return viewports; }
/** * * @param tileMap ширина, высота и размер тайла берется из первого слоя: * TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0); * cellSize = (int) bg.getTileHeight(); mapW = bg.getWidth(); mapH = * bg.getHeight(); */ public ScrollMap(TiledMap tileMap) { mapCamera = new OrthographicCamera(); mapRenderer = new OrthogonalTiledMapRenderer(tileMap, 1f/* / cellSize */); stageViewport = new ScreenViewport(new OrthographicCamera()); TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0); cellSize = (int) bg.getTileHeight(); mapW = bg.getWidth() * cellSize; mapH = bg.getHeight() * cellSize; mapHolder = new Actor(); mapHolder.setSize(mapW, mapH); scrollPane = new ScrollPane(mapHolder); scrollPane.setOverscroll(false, false); root = new Table(); root.setFillParent(true); root.add(scrollPane).fill().expand(); stage = new Stage(stageViewport); stage.addActor(root); im = new InputMultiplexer(); gameBatch = mapRenderer.getSpriteBatch(); sprites = new Array<Sprite>(); gestureDetector = new GestureDetector(gestureListener); }
public BaseScreen() { this.stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(this.stage); this.stage.addListener(new InputListener(){ @Override public boolean keyDown(InputEvent event, int keycode) { if((keycode == Keys.BACK) || (keycode == Keys.ESCAPE)) { BaseScreen.this.backButtonPressed(); } if(keycode == Keys.ENTER) { BaseScreen.this.enterButtonPressed(); } return super.keyDown(event, keycode); } }); }
@Override public void create() { stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); VisUI.load(); TabbedPane pane = new TabbedPane(); pane.add(new MapTab("Kbd & Mouse")); pane.add(new MapTab("Controller")); final VisTable contentTable = new VisTable(); stage.addActor(contentTable); stage.addActor(pane.getTable()); pane.addListener(new TabbedPaneAdapter() { @Override public void switchedTab(Tab tab) { contentTable.clearChildren(); contentTable.add(tab.getContentTable()).expand().fill(); } }); }
@Override public void show() { modal = true; Vloxlands.assets.load("img/logo/logo256.png", Texture.class); Vloxlands.assets.load("img/logo/logo256-blur.png", Texture.class); Vloxlands.assets.finishLoading(); stage = new Stage(new ScreenViewport()); font = new BitmapFont(); logo = new Image(Vloxlands.assets.get("img/logo/logo256.png", Texture.class)); blur = Vloxlands.assets.get("img/logo/logo256-blur.png", Texture.class); worldGenerator = new WorldGenerator(); stage.addActor(logo); InternalAssetManager.scheduleDirectory(Vloxlands.assets, "img", Texture.class, true); InternalAssetManager.scheduleDirectory(Vloxlands.assets, "models", Model.class, new FileNameExtensionFilter("g3db", "vxi"), true); }
public LevelScreen(final NinjaRabbitGame game) { super(game); world = new World(new Vector2(0.0f, GRAVITY), true); hud = new StatusBar(game.getBatch(), game.getAssetsManager()); BodyEditorLoader bodyLoader = new BodyEditorLoader(Gdx.files.internal(BODIES_DEFINITION_FILE)); ninjaRabbit = EntityFactory.createNinjaRabbit(world, bodyLoader, game.getAssetsManager(), game.getPlayerStatus(), hud); LevelRenderer mapRenderer = LevelFactory.create(world, bodyLoader, game.getBatch(), game.getAssetsManager(), game.getPlayerStatus() .getLevel(), 1 / NinjaRabbitGame.PPM); environment = EntityFactory.createEnvironment(world, game.getBatch(), mapRenderer, game.getAssetsManager(), game.getPlayerStatus(), (PlayerStatusObserver[]) null); viewport = new ScreenViewport(); viewport.setUnitsPerPixel(1 / NinjaRabbitGame.PPM); viewport.setCamera(new BoundedCamera(0.0f, mapRenderer.getTiledMap().getProperties().get("width", Integer.class).floatValue() * mapRenderer.getTiledMap().getProperties().get("tilewidth", Integer.class).floatValue() / NinjaRabbitGame.PPM)); }
@Override public void create () { VisUI.load(); stage = new Stage(new ScreenViewport()); final Table root = new Table(); root.setFillParent(true); stage.addActor(root); TestWindow window = new TestWindow(); TestCollapsible collapsible = new TestCollapsible(); window.setKeepWithinParent(true); window.setPosition(110, 110); collapsible.setKeepWithinParent(true); collapsible.setPosition(200, 200); FloatingGroup floatingGroup = new FloatingGroup(1000, 600); floatingGroup.addActor(window); floatingGroup.addActor(collapsible); root.debugAll(); root.left().bottom(); root.add(floatingGroup).padLeft(100).padBottom(100); Gdx.input.setInputProcessor(stage); }
private Stage createStage () { stageViewport = new ScreenViewport(); Stage stage = new Stage(stageViewport); //the stage root is final field, by default group does not support actor changed events and we need that //here we just set our custom group to get those events try { stageRoot = new VisGroup(stage); Field field = stage.getClass().getDeclaredField("root"); field.setAccessible(true); field.set(stage, stageRoot); } catch (ReflectiveOperationException e) { Log.exception(e); } return stage; }
public MainScreen(SkinEditorGame game) { this.game = game; barMenu = new MenuBar(game); barWidgets = new WidgetsBar(game); panePreview = new PreviewPane(game); paneOptions = new OptionsPane(game); stage = new Stage(new ScreenViewport()); Table table = new Table(); table.setFillParent(true); table.top().left().add(barMenu).expandX().fillX().colspan(2).row(); table.top().left().add(barWidgets).expandX().fillX().colspan(2).row(); table.top().left().add(paneOptions).width(420).left().fill().expandY(); ScrollPane scrollPane = new ScrollPane(panePreview); table.add(scrollPane).fill().expand(); stage.addActor(table); barWidgets.initializeButtons(); }
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); Gdx.gl.glClearColor(0f, 0f, 0f, 0f); stage = new Stage(new ScreenViewport()); WidgetGroup modalContainer = new WidgetGroup(); modalContainer.setFillParent(true); WidgetGroup viewContainer = new WidgetGroup(); viewContainer.setFillParent(true); stage.getRoot().addActor(viewContainer); stage.getRoot().addActor(modalContainer); Gdx.input.setInputProcessor(stage); actor = new LoadingIndicator(); if (actor instanceof WidgetGroup) { ((WidgetGroup) actor).setFillParent(true); } viewContainer.addActor(actor); }
protected Stage createStage() { batch = new PolygonSpriteBatch(2500) { final int MAX = 2500 * 5; @Override public void draw(Texture texture, float[] spriteVertices, int offset, int count) { while (count > MAX) { super.draw(texture, spriteVertices, offset, MAX); offset += MAX; count -= MAX; } super.draw(texture, spriteVertices, offset, count); } }; return new Stage(new ScreenViewport(), batch); }
/** * Makes a MenuScreen. * * @param game * The game containing this screen. * @param skinHandle * A FileHandle pointing to the UI skin. * @param title * The title of the menu. * @param textHandle * A FileHandle pointing to the background texture. Null if no * background is needed. */ public MenuScreen(Game game, FileHandle skinHandle, String title, FileHandle textureHandle) { super(game); skin = new Skin(skinHandle); stage = new Stage(new ScreenViewport()); this.title = title; if (textureHandle != null) { Texture backgroundTexture = new Texture(textureHandle); TextureRegion source = new TextureRegion(backgroundTexture); background = new TextureRegionDrawable(source); } initialize(); }
@Override public void show() { stage = new Stage(new ScreenViewport()); mainTable = new Table(); stage.addActor(mainTable); mainTable.setFillParent(true); mainTable.setDebug((boolean) game.showDebugStuff()); game.setInputProcessor(stage); initUI(); }
@Override public void show() { spriteBatch = new SpriteBatch(); stage = new Stage(new ScreenViewport()); stage.addActor(bg); Gdx.input.setInputProcessor(stage); }