/** * Creates a new LoadingScreenView. * * <p><b>Note:</b> This will load textures directly, and it is therefore important to remember to * dispose this view! */ public LoadingScreenView() { // Background screenBgTexture = new Texture(Gdx.files.internal("data/loadingScreenBg.png")); Image screenBg = new Image(screenBgTexture); screenBg.setFillParent(true); addActor(screenBg); // The loading bar background loadBarBgTexture = new Texture(Gdx.files.internal("data/loadingBarBg.png")); loadBarBgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); loadBarBg = new Image(loadBarBgTexture); loadBarBg.setY(LOAD_BAR_BOTTOM_MARGIN); loadBarBg.setWidth(LOAD_BAR_MAX_WIDTH); loadBarBg.setX(1280 / 2 - LOAD_BAR_MAX_WIDTH / 2); addActor(loadBarBg); // The loading bar loadBarTexture = new Texture(Gdx.files.internal("data/loadingBar.png")); loadBarTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); loadBar = new Image(loadBarTexture); loadBar.setY(LOAD_BAR_BOTTOM_MARGIN); loadBar.setX(loadBarBg.getX()); loadBar.setWidth(LOAD_BAR_MAX_WIDTH); addActor(loadBar); // Progress label progressLabelFont = new BitmapFont(Gdx.files.internal("data/fonts/arial_bold_32.fnt"), false); progressLabelFont .getRegion() .getTexture() .setFilter(TextureFilter.Linear, TextureFilter.Linear); LabelStyle ls = new LabelStyle(progressLabelFont, Color.BLACK); progressLabel = new Label("", ls); progressLabel.setY(65); addActor(progressLabel); }
@Override public void show() { // BackButton Handeling Drawable menuDrawable = new TextureRegionDrawable( new TextureRegion(new Texture(Gdx.files.internal("images/backgroundlevel.png")))); backGImage = new Image(menuDrawable, Scaling.stretch); backGImage.setFillParent(true); stage.addActor(backGImage); skin = new Skin(Gdx.files.internal("ui/JsonFiles/uiskin.json")); skin.add( "top", new TextureRegionDrawable( new TextureRegion( new Texture(Gdx.files.internal("images/levelscreen.png")), 153, 88, 150, 150)), Drawable.class); skin.add( "lockedlevel", new TextureRegionDrawable( new TextureRegion( new Texture(Gdx.files.internal("images/levelscreen.png")), 1, 88, 150, 150)), Drawable.class); skin.add( "star-filled", new TextureRegionDrawable( new TextureRegion( new Texture(Gdx.files.internal("images/levelscreen.png")), 1, 1, 90, 85)), Drawable.class); skin.add( "star-unfilled", new TextureRegionDrawable( new TextureRegion( new Texture(Gdx.files.internal("images/levelscreen.png")), 93, 1, 90, 85)), Drawable.class); // skin.add("star-filled", skin.newDrawable("white", Color.YELLOW), // Drawable.class); // skin.add("star-unfilled", skin.newDrawable("white", Color.GRAY), // Drawable.class); Gdx.input.setInputProcessor(stage); container = new Table(); stage.addActor(container); container.setFillParent(true); PagedScrollPane scroll = new PagedScrollPane(); scroll.setFlingTime(0.4f); scroll.setPageSpacing(80); int c = 1; for (int l = 0; l < 2; l++) { Table levels = new Table().pad(0); levels.defaults().pad(0, 20, 0, 15); for (int y = 0; y < 2; y++) { levels.row(); for (int x = 0; x < 3; x++) { levels.add(getLevelButton(c++)).fill().expand().size(63, 88); } } scroll.addPage(levels); } container.add(scroll).expand().fill(); // backGImage.addAction(parallel(moveTo(250, 250, 2, bounceOut), // color(Color.RED, 6), delay(0.5f), rotateTo(180, 5, swing))); backGImage.addAction( repeat(1, (sequence(scaleTo(2, 2, 0.8f), scaleTo(1, 1, 0.8f), delay(1.9f))))); InputProcessor backProcessor = new InputAdapter() { @Override public boolean keyDown(int keycode) { if ((keycode == Keys.ESCAPE) || (keycode == Keys.BACK)) game.setScreen(game.getMenuScreen()); return false; } }; InputMultiplexer multiplexer = new InputMultiplexer(stage, backProcessor); Gdx.input.setInputProcessor(multiplexer); Gdx.input.setCatchBackKey(true); }