diff --git a/android/assets/uiskin.atlas b/android/assets/uiskin.atlas index 26a0ec1..c04f622 100755 --- a/android/assets/uiskin.atlas +++ b/android/assets/uiskin.atlas @@ -258,7 +258,7 @@ arrow orig: 44, 44 offset: 0, 0 index: -1 -three-quart-circle +loading rotate: false; xy: 136, 50 size: 44, 44 diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index 946c899..c20ac33 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -24,16 +24,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle; import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; -import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Slider.SliderStyle; import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; -import zero1hd.polyjet.screens.GameScreen; import zero1hd.polyjet.screens.MainMenu; -import zero1hd.polyjet.screens.PreGameScreen; import zero1hd.polyjet.screens.LoadingScreen; public class Polyjet extends Game { @@ -51,12 +48,6 @@ public class Polyjet extends Game { TextureAtlas skinAtlas; public Preferences prefs; - //screens - public MainMenu mainMenuScreen; - public PreGameScreen preGameScreen; - public GameScreen gameScreen; - - @Override public void create() { @@ -73,7 +64,7 @@ public class Polyjet extends Game { + Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n" + "Pixel density (PPI): " + Gdx.graphics.getDensity()); - setScreen(mainMenuScreen = new MainMenu(this)); + setScreen(new MainMenu(this)); Resolution[] resolution = { new Resolution(800, 480, "800x480"), @@ -223,7 +214,6 @@ public class Polyjet extends Game { public void resize(int width, int height) { if (initComplete) { defaultSkin.dispose(); - gameScreen = null; assetManager.clear(); prefs.putInteger("screen-width", width); prefs.putInteger("screen-height", height); diff --git a/core/src/zero1hd/polyjet/screens/PreGameScreen.java b/core/src/zero1hd/polyjet/screens/PreGameScreen.java index 82ec3d6..8c4bba0 100755 --- a/core/src/zero1hd/polyjet/screens/PreGameScreen.java +++ b/core/src/zero1hd/polyjet/screens/PreGameScreen.java @@ -17,6 +17,7 @@ import zero1hd.polyjet.TransitionAdapter; import zero1hd.polyjet.audio.AudioAnalyzer; import zero1hd.polyjet.audio.WavAudioData; import zero1hd.polyjet.maps.RhythmMap; +import zero1hd.polyjet.ui.MusicSelectionPage; public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { @@ -32,6 +33,8 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { Label lastStatement; + MusicSelectionPage musicSelection; + public PreGameScreen(final Polyjet core) { this.core = core; analyzer = new AudioAnalyzer(); @@ -42,13 +45,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { stage.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { - if (phase == 4) { - if (core.gameScreen != null) { - core.setScreen(core.gameScreen); - } else { - core.setScreen((core.gameScreen = new GameScreen(core))); - } - } + core.setScreen(new GameScreen(core)); super.clicked(event, x, y); } }); @@ -61,6 +58,8 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { public void postTransition() { stage.clear(); //draw music selector + musicSelection = new MusicSelectionPage(core, core.defaultSkin); + stage.addActor(musicSelection); statusText = new Label(null, core.defaultSkin); statusText.setPosition(1.6f*Gdx.graphics.getWidth(), (Gdx.graphics.getHeight()-statusText.getHeight())/2); @@ -88,9 +87,6 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { stage.act(); stage.draw(); switch (phase) { - case 0: - - break; case 1: if (stage.getCamera().position.x != cameraTarget.x) { stage.getCamera().position.lerp(cameraTarget, 0.25f); diff --git a/core/src/zero1hd/polyjet/ui/MainPage.java b/core/src/zero1hd/polyjet/ui/MainPage.java index 5cf516b..bfefa43 100755 --- a/core/src/zero1hd/polyjet/ui/MainPage.java +++ b/core/src/zero1hd/polyjet/ui/MainPage.java @@ -99,12 +99,7 @@ public class MainPage extends Page { Actions.run(new Runnable() { @Override public void run() { - - if (core.preGameScreen != null) { - core.setScreen(core.preGameScreen); - } else { - core.setScreen(core.preGameScreen = new PreGameScreen(core)); - } + core.setScreen(new PreGameScreen(core)); } }), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f)))); } diff --git a/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java index 44ab580..6740107 100755 --- a/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java +++ b/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java @@ -1,7 +1,21 @@ package zero1hd.polyjet.ui; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; + +import zero1hd.polyjet.Polyjet; + public class MusicSelectionPage extends Page { - public MusicSelectionPage() { + Image loading; + + public MusicSelectionPage(Polyjet core, Skin skin) { + super("Select music", skin); + loading = new Image(skin, "loading"); + loading.setPosition((getWidth()-loading.getWidth())/2, (getHeight()-loading.getHeight())/2); + loading.setOrigin(loading.getWidth()/2, loading.getHeight()/2); + loading.addAction(Actions.forever(Actions.rotateBy(-360f, 2f))); + addActor(loading); } } diff --git a/core/src/zero1hd/polyjet/ui/Page.java b/core/src/zero1hd/polyjet/ui/Page.java index 05d8a9d..fce6df9 100755 --- a/core/src/zero1hd/polyjet/ui/Page.java +++ b/core/src/zero1hd/polyjet/ui/Page.java @@ -3,10 +3,22 @@ package zero1hd.polyjet.ui; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Touchable; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; public class Page extends Group { + private Label pageTitle; + public Page() { setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); setTouchable(Touchable.childrenOnly); } + + public Page(String titleText, Skin skin) { + setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + setTouchable(Touchable.childrenOnly); + pageTitle = new Label(titleText, skin, "large-font", skin.getColor("default")); + pageTitle.setPosition(18f, getHeight()-pageTitle.getHeight()-15f); + addActor(pageTitle); + } } diff --git a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java index 0f29cbc..c9e3077 100755 --- a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java +++ b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java @@ -7,8 +7,12 @@ import com.badlogic.gdx.Preferences; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Image; -import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; import com.mpatric.mp3agic.ID3v2; import com.mpatric.mp3agic.InvalidDataException; import com.mpatric.mp3agic.Mp3File; @@ -16,7 +20,7 @@ import com.mpatric.mp3agic.UnsupportedTagException; import zero1hd.wavedecoder.WavInfo; -public class MusicSelectable extends WidgetGroup { +public class MusicSelectable extends ImageButton { Image imageIcon; FileHandle musicFile; boolean invalidMusic; @@ -25,7 +29,9 @@ public class MusicSelectable extends WidgetGroup { WavInfo wavinfo; - public MusicSelectable(FileHandle musicFile, Preferences musicData) { + public MusicSelectable(FileHandle musicFile, Preferences musicData, Skin skin) { + super(skin, "info-pane"); + this.musicFile = musicFile; if (musicFile.extension().toLowerCase().equals("mp3")) { @@ -43,6 +49,9 @@ public class MusicSelectable extends WidgetGroup { float scale = 0.25f*Gdx.graphics.getHeight()/imageIcon.getHeight(); imageIcon.setScale(scale); + + add(imageIcon); + albumArtTexture.dispose(); songName = id3v2tag.getTitle(); diff --git a/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java index 361c544..b1ec2f5 100755 --- a/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java +++ b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java @@ -16,6 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.polyjet.Polyjet; import zero1hd.polyjet.audio.AudioAnalyzer; import zero1hd.polyjet.audio.WavAudioData; +import zero1hd.polyjet.screens.MainMenu; import zero1hd.polyjet.ui.windows.BeatViewer; import zero1hd.polyjet.ui.windows.FPSWindow; import zero1hd.polyjet.ui.windows.GraphWindow; @@ -58,7 +59,7 @@ public class CreativeStage extends Stage { @Override public void changed(ChangeEvent event, Actor actor) { dispose(); - core.setScreen(core.mainMenuScreen); + core.setScreen(new MainMenu(core)); } }); backButton.setPosition(10, Gdx.graphics.getHeight()-backButton.getHeight()-10); diff --git a/core/src/zero1hd/polyjet/ui/windows/MusicController.java b/core/src/zero1hd/polyjet/ui/windows/MusicController.java index 1ca5a39..dc52794 100755 --- a/core/src/zero1hd/polyjet/ui/windows/MusicController.java +++ b/core/src/zero1hd/polyjet/ui/windows/MusicController.java @@ -43,7 +43,7 @@ public class MusicController extends Window { add(rewind).center(); - togglePlay = new Image(skin.getDrawable("three-quart-circle")) { + togglePlay = new Image(skin.getDrawable("loading")) { @Override public void act(float delta) { if (audiofile.getPlaybackMusic() != null) { @@ -118,7 +118,7 @@ public class MusicController extends Window { public void setMusicReady(boolean musicReady) { this.musicReady = musicReady; if (!musicReady) { - togglePlay.setDrawable(skin.getDrawable("three-quart-circle")); + togglePlay.setDrawable(skin.getDrawable("loading")); info.setText("Analyzing..."); } else { togglePlay.setDrawable(skin.getDrawable("arrow"));