public Stage createLoadingStage(){ Stage stage = createStage(); stage.setViewport(viewport); stage.addActor(new GameObjectBodyless(new Texture("default_background.png"))); GameObjectBodyless gameObjectBodyless = new GameObjectBodyless(new Texture("loading_screen_part1.png")){ @Override public void act(float delta) { super.act(delta); getSprite().setOriginCenter(); getSprite().rotate(3); } }; gameObjectBodyless.setPosition(viewport.getScreenWidth() - gameObjectBodyless.getSprite().getWidth(), viewport.getScreenHeight() - gameObjectBodyless.getSprite().getHeight()); stage.addActor(gameObjectBodyless); return stage; }
public Hud(SpriteBatch sb) { countKill = 0; viewport = new FitViewport(ScreenConf.V_WIDTH, ScreenConf.V_HEIGHT, new OrthographicCamera()); stage = new Stage(viewport, sb); Table table = new Table(); table.setFillParent(true); table.top(); countKillLabel = new Label(String.format("%03d", countKill), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); table.add(countKillLabel).expandX().padTop(10); table.add().expandX(); table.add().expandX(); table.add().expandX(); stage.addActor(table); }
public KnightActionsWindow displayActions(Stage stage) { if (stage != null) { // Create the window if it's not created if (actionWindow == null) actionWindow = new KnightActionsWindow(this); actionWindow.setPosition(getX() + getWidth(), getTop()); // Add the window if not already added if (!actionWindow.hasParent()) stage.addActor(actionWindow); return actionWindow; } return null; }
/** * Menu Screen's constructor. * It initializes all the Menu elements. * * @param game The current game session. */ protected MenuScreen(final Armadillo game) { this.game = game; batch = game.getBatch(); gameServices = game.getGameServices(); skin1 = game.getPrimarySkin(); skin2 = game.getSecondarySkin(); viewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); viewport.apply(); stage = new Stage(viewport, batch); backgroundImg = new Image(game.getAssetManager().get("background.png", Texture.class)); backgroundImg.setScale(VIEWPORT_WIDTH / backgroundImg.getWidth(), VIEWPORT_HEIGHT / backgroundImg.getHeight()); titleImg = new Image(game.getAssetManager().get("armadillo_title.png", Texture.class)); titleImg.setSize(0.8f * titleImg.getWidth(), 0.8f * titleImg.getHeight()); titleImg.setPosition(VIEWPORT_WIDTH / 2 - titleImg.getWidth() / 2, VIEWPORT_HEIGHT * 0.98f - titleImg.getHeight()); }
@Override public void create () { camera = new OrthographicCamera(); camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); stage = new Stage(); stage.addListener(new InputListener(){ @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){ stage.getActors().get(counter).addAction(Actions.moveTo(x-50,y-50,1)); counter++; if(counter==stage.getActors().size) { counter=0; } return true; } }); Gdx.input.setInputProcessor(stage); }
@Override protected void setStage(Stage stage) { if (stage == null) { for (int i = 0; i < 9; i++) { if (c.itemStacks[i] != null) InventoryHelper.addItemstack(Cubes.getClient().player.getInventory(), c.itemStacks[i]); } } super.setStage(stage); }
@Override public void show() { player = new Player(Assets.random()); client = new Client(player); stage = new Stage(); Image logo = new Image(Assets.LOGO); logo.setPosition((Gdx.graphics.getWidth() - logo.getWidth()) / 2, Gdx.graphics.getHeight() * 0.85f); Image shadow = dropShadow(logo); stage.addActor(logo); stage.addActor(shadow); stage.addActor(new PlayGroup(client)); stage.getRoot().addCaptureListener(new InputListener() { public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (!(event.getTarget() instanceof TextField)) stage.setKeyboardFocus(null); return true; } }); Gdx.input.setInputProcessor(stage); }
public HudScene(SpriteBatch batch, ShapeRenderer shapeRenderer, ArcRenderer arcRenderer) { this.batch = batch; stage = new Stage(); VisUI.load(); Table table = new Table(); table.top(); table.setFillParent(true); scoreLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET)); setScore(score); balanceLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET)); setBalance(balance); table.add(scoreLabel).align(Align.left).expandX(); table.add(balanceLabel).align(Align.right).expandX(); stage.addActor(table); ringButton = new RingButton(shapeRenderer, arcRenderer); ringButton.setBounds(10, 10, 100, 100); stage.addActor(ringButton); }
@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 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 void create() { stage = new Stage(); Gdx.input.setInputProcessor(stage); //font = new BitmapFont(); //skin = new Skin(); //buttonAtlas = new TextureAtlas(Gdx.files.internal()); //skin.addRegions(buttonAtlas); button = new Button(); button.setStyle(new Button.ButtonStyle()); button.addCaptureListener(new EventListener() { @Override public boolean handle(Event event) { Gdx.app.log("LOG", "event " + event); return false; } }); stage.addActor(button); }
/** * Method responsible for initializing the main menu * Called when the screen becomes the current screen of the game */ @Override public void show() { cam = new OrthographicCamera(); viewport = new FitViewport(1920, 1080); viewport.setCamera(cam); stage = new Stage(viewport); stage.setViewport(viewport); skin = settingsAssets.styles_json; int x = 1920; int y = 1080; spriteBatch = new SpriteBatch(); mainbackground = settingsAssets.testmainscreen; BitmapFont font = settingsAssets.bocklin_fnt; TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton); inputTable = new Table(); keys = IInputConfig.InputKeys.values(); keyMap = new HashMap<>(); initInputRows(font, backgroundTexture); createBackButton(); AL.input.setInputProcessor(new InputMultiplexer(stage, this)); }
@Override public void show() { if(drawone){ addBackgroundExtension(); addPuls(); addimagebg(); addButtonBottom(); drawone = false; } cameraGroupStrategy = new CameraGroupStrategy(camera); batch = new DecalBatch(cameraGroupStrategy); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); addtostage(); Gdx.input.setCatchBackKey(true); inputmulti = new InputMultiplexer(); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }
@Override public void show() { if(drawone){ addroomselect(); addButtonBottom(); addPuls(); addimagebg(); addbuildRoom(); addtimerbuildroom(); drawone = false; } cameraGroupStrategy = new CameraGroupStrategy(camera); // CameraInputController controller = new CameraInputController(camera); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); batchsprite = new SpriteBatch(); addtostage(); batch = new DecalBatch(this.cameraGroupStrategy); Gdx.input.setCatchBackKey(true); InputMultiplexer inputmulti = new InputMultiplexer(); inputmulti.addProcessor(stage); Gdx.input.setInputProcessor(inputmulti); }
@Override public void show() { if(drawone){ addActiveRooms(); createBuildRoom(); createAddExtensionGroup(); addDescribeEnklave(); drawone = false; } backButton.setChecked(false); Gdx.input.setCatchBackKey(true); stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); addtoStage(stage); stage.addActor(backButton); Gdx.input.setInputProcessor(stage); }
@Override public void show() { stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())); if(drawone) { initializeMenuTab(); manager.loadAssetsSettings(); manager.getAssetsSettings().finish(); addSettingTutorial(); addSettingPresentation(); addChangeFaction(); addKeepScreenOn(); addTestCombat(); drawone = false; } addtoStage(); checkButtons(); b5.setChecked(true); sp.setScrollPercentX(100); sp.updateVisualScroll(); backButton.setChecked(false); Gdx.input.setCatchBackKey(true); Gdx.input.setInputProcessor(stage); }
@Override public Dialog show(Stage stage, Action action) { previousFocussedActor = null; previousEscapeActor = null; super.show(stage, action); if (stage instanceof ControllerMenuStage) { previousFocussedActor = ((ControllerMenuStage) stage).getFocussedActor(); previousEscapeActor = ((ControllerMenuStage) stage).getEscapeActor(); if (buttonsToAdd.size >= 1) ((ControllerMenuStage) stage).setFocussedActor(buttonsToAdd.get(0)); if (buttonsToAdd.size == 1) ((ControllerMenuStage) stage).setEscapeActor(buttonsToAdd.get(0)); } return this; }
private void initHud() { hud = new Stage(viewport, batch); Gdx.input.setInputProcessor(new InputMultiplexer(new KeyboardInputHandler(), hud)); //init widgets ColorButton[] colorButtons = createColorButtons(); final ShapeButton[] shapeButtons = createShapeButtons(colorButtons); // add widgets to stage for (ShapeButton shapeButton : shapeButtons) { hud.addActor(shapeButton); } for (ColorButton colorButton : colorButtons) { hud.addActor(colorButton); } TextureAtlas textureAtlas = polymorph.getAssetManager().get(Polymorph.MASTER_PATH, TextureAtlas.class); hud.addActor(createHealthBar(textureAtlas)); hud.addActor(createPauseButton(textureAtlas)); }
public QuestBoardDialog(ActorManipulator linkedContainer, long id, QuestDataPacket[] quests, Stage containerForPopUpDialog, PacketsSender packetsSender) { super("Quests", linkedContainer, id); for(QuestDataPacket quest : quests) { QuestPosition questPosition = new QuestPosition(quest.getName(), quest.getDescription(), containerForPopUpDialog, packetsSender); questPositions.put(quest.getName(), questPosition); getContentTable().add(questPosition); getContentTable().row(); } if(questPositions.isEmpty()) addNoQuestsAvailableLabel(); this.pack(); }
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)); }
@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 protected boolean onUpdate(float dt) { Stage stage = input.getStage(); if(stage != null) { stage.setKeyboardFocus(input); } flushOutput(); return true; }
@Override public void start() { skin = getCore().getAssetManager().get(Core.DATA_PATH + "/skin/skin.json", Skin.class); stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); Image bg = new Image(skin, "sky"); bg.setFillParent(true); stage.addActor(bg); createBG(); createMenu(); }
public void setListeners(Stage stage) { stage.addListener(new InputListener() { @Override public boolean scrolled(InputEvent event, float x, float y, int amount) { if (editingZone != null) editingZone.zoomBy(amount); return false; } }); }
public Stage createStartStage(){ Stage stage = createStage(); stage.setViewport(viewport); stage.addActor(new GameObjectBodyless(new Texture("splash_screen1.png")){ private int i = 100; private int counter = 0; @Override public void act(float delta) { super.act(delta); if (i < 0){ i = 100; counter++; if (counter == 2){ remove(); setChanged(); notifyObservers("StartStageEnd"); } setTexture(new Texture("splash_screen2.png")); setSprite(new Sprite(getTexture())); } else if (i >= 0) { i--; } } }); return stage; }
private void setupUI() { stage = new Stage(); VisTable root = new VisTable(); stage.addActor(root); root.setFillParent(true); root.align(Align.center); VisLabel label = new VisLabel("It appears you have already opened an instance of this app.\n\n" + "To ensure data integrity this is not possible. If you are sure that no open app " + "instance exists delete the lock file ~/.gdxsplash/.lock and restart GdxSplash."); label.setAlignment(Align.center); label.setWrap(true); root.add(label).pad(10).grow().row(); }
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 GameUI(PlanetGeneratorGame game) { this.game = game; this.scene = game.getScene(); stage = new Stage(); initialize(); }
@Override protected void setStage(Stage stage) { super.setStage(stage); // Every time this window is displayed, do these checks... Knight knight = knightActor.getKnight(); promoteButton.setDisabled(knight.is(MIGHTY) || knight.isPromotedThisTurn()); activateButton.setDisabled(knight.isActive() || knight.isActivatedThisTurn()); moveButton.setDisabled(!knight.isActive() || knight.isActivatedThisTurn()); }
@Override public void show() { bg = new Texture("BG.png"); bg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); stage = new Stage(); Gdx.input.setInputProcessor(stage); if (skin == null) createBasicSkin(); // Create & add the window CatanWindow window = new CatanWindow(TITLE, skin); stage.addActor(window); Label usernameLabel = new Label ("Username:", skin); TextField usernameText = new TextField ("", skin); Label passwordLabel = new Label ("Password:", skin); TextField passwordText = new TextField("", skin); /*//Create table Table mainTable = new Table(); //add labels to table mainTable.add(usernameLabel); mainTable.add(usernameText).width(200); mainTable.row(); mainTable.add(passwordLabel); mainTable.add(passwordText).width(200); mainTable.setFillParent(true); stage.addActor(mainTable);*/ }
/** * Constructor taking scene name and color used to clear background. * @param sceneName Scene's name. * @param clearColor Color used to clear background. */ protected SceneBase(String sceneName, Color clearColor) { this.sceneName = sceneName; this.clearColor = clearColor; sceneObjects = new LinkedList<>(); stage = new Stage(); }
public Chat(SpriteBatch batch){ field = new TextField("", Assets.getInstance().getSkin()); field.setVisible(false); table = new Table(); table.bottom().padLeft(20).padRight(20).padBottom(10).setFillParent(true); table.setDebug(false); table.add(field).width(Config.SCREEN_WIDTH-40); stage = new Stage(new FillViewport(Config.SCREEN_WIDTH,Config.SCREEN_HEIGHT,new OrthographicCamera()),batch); stage.addActor(table); stage.setKeyboardFocus(field); }
/** * A Handle can overwrite this function if you don't want to use the default * variadic parameter parsing. * * @param parent * @param variadic */ public void initialise(Stage parent, Object... variadic) { this.parent = parent; int length = variadic.length; for (int i = 0; i < length; i++) { Object o = variadic[i]; /** Register the class we get */ register(o.getClass(), o); } }
public Match(Client client, Player player) { Match.client = client; this.tiles = Match.client.getMap(); this.player = player; cam = new ConquestCamera(this.tiles); stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), cam)); Group tileGroup = new Group(); Group labelGroup = new Group(); for (Tile t : this.tiles) { t.setTexture(); tileGroup.addActor(t); labelGroup.addActor(t.getLabel()); } Tile random = this.tiles.get(MathUtils.random(this.tiles.size - 1)); while (random.getOwner() != Owner.None) { random = this.tiles.get(MathUtils.random(this.tiles.size - 1)); } player.setCapital(random); client.send(random); cam.position.set(random.getX(Align.center), random.getY(Align.center), 0); stage.addActor(tileGroup); stage.addActor(labelGroup); }
@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); }
@Override protected void setStage(Stage stage) { if (stage == null && getStage() != null && getStage() instanceof ControllerMenuStage) { for (int i = 0; i < buttonsToAdd.size; i++) ((ControllerMenuStage) getStage()).removeFocussableActor(buttonsToAdd.get(i)); } super.setStage(stage); if (stage != null && stage instanceof ControllerMenuStage) { for (int i = 0; i < buttonsToAdd.size; i++) ((ControllerMenuStage) stage).addFocussableActor(buttonsToAdd.get(i)); } }
@Override public void show () { //orthographicCamera = new OrthographicCamera(3840, 2160); matrix4 = new Matrix4(); spriteBatch = new SpriteBatch(); viewport = new FitViewport(2560, 1440, new OrthographicCamera()); viewport.apply(); stage = new Stage(viewport); camera = createCamera(); multiplexer = new InputMultiplexer(); multiplexer.addProcessor(stage); Gdx.input.setInputProcessor(multiplexer); if(TDGalaxy.preferences.isDebug()) stage.setDebugAll(true); }
@Override public void create() { game_prefs = Gdx.app.getPreferences(prefs_name); game_stage = new Stage(view); game_states = new ObjectMap<String, GameState>(); game_stage.setDebugAll(false); current_gamestates = new Array<GameState>(); transition_state = new GameState(null); transition_state.setGame(this); assets = new AssetManager(); assets.setLoader(TiledMap.class, new KyperMapLoader(assets.getFileHandleResolver())); assets.setLoader(ParticleEffect.class, new ParticleEffectLoader(assets.getFileHandleResolver())); assets.setLoader(ShaderProgram.class, new ShaderProgramLoader(assets.getFileHandleResolver(), VERTEX_SUFFIX, FRAGMENT_SUFFIX)); sound = new SoundManager(this); packages = new Array<String>(); packages.add("com.kyperbox.objects"); global_data = new UserData(GAME_DATA_NAME); input = new GameInput(); Gdx.input.setInputProcessor(game_stage); initiate(); }
public Hud(SpriteBatch sb) { worldTimer = 300; timeCount = 0; score = 0; viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.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-1", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); // worldLabel = new Label("WORLD", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); // dudeLabel = new Label("DUDE", new Label.LabelStyle(new BitmapFont(), Color.WHITE)); table.add(dudeLabel).expandX().padTop(10); table.add(worldLabel).expandX().padTop(10); table.add(timeLabel).expandX().padTop(10); table.row(); table.add(scoreLabel).expandX(); table.add(levelLabel).expandX(); table.add(countDownLabel).expandX(); stage.addActor(table); }
public EndScreen(NoObjectionGame game) { this.game = game; bg = new Texture("pixil-layer-Background2.png"); viewport = new StretchViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera()); stage = new Stage(viewport, ((NoObjectionGame) game).batch); }