diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index 78e042c..95124a7 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -241,7 +241,6 @@ public class Polyjet extends Game { super.resize(width, height); } - public int fontScale(float fontSize) { Gdx.app.debug("Font pixel size", MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())) + "px"); return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())); diff --git a/core/src/zero1hd/polyjet/screens/PreGameScreen.java b/core/src/zero1hd/polyjet/screens/PreGameScreen.java index d45c42c..d6e6cd2 100755 --- a/core/src/zero1hd/polyjet/screens/PreGameScreen.java +++ b/core/src/zero1hd/polyjet/screens/PreGameScreen.java @@ -2,116 +2,45 @@ package zero1hd.polyjet.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; -import com.badlogic.gdx.graphics.GL20; -import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.actions.Actions; -import com.badlogic.gdx.scenes.scene2d.ui.Image; -import com.badlogic.gdx.scenes.scene2d.ui.Label; -import zero1hd.polyjet.Polyjet; -import zero1hd.polyjet.audio.Audio; -import zero1hd.polyjet.audio.WavAudioData; -import zero1hd.polyjet.ui.pages.AnalyzePage; -import zero1hd.polyjet.ui.pages.MusicSelectionPage; import zero1hd.polyjet.util.MiniEvents; import zero1hd.polyjet.util.MiniListener; import zero1hd.polyjet.util.TransitionAdapter; public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, MiniListener { - Polyjet core; Stage stage; - Label statusText; - - WavAudioData audiofile; - Vector3 cameraTarget; - Label lastStatement; + Vector3 cameraPos; - private MainMenu mainMenu; - private MusicSelectionPage musicSelection; - private AnalyzePage analyzePage; - public PreGameScreen(final Polyjet core, MainMenu mainMenu) { - this.core = core; - - this.mainMenu = mainMenu; - + public PreGameScreen() { stage = new Stage(); - - cameraTarget = new Vector3(stage.getCamera().position); - postTransition(); - } - - @Override - public void postTransition() { - stage.clear(); - - Image cyberCircle1 = new Image(core.getAssetManager().get("cybercircle3B.png", Texture.class)); - cyberCircle1.setScale(0.8f); - cyberCircle1.setOrigin(cyberCircle1.getWidth()/2, cyberCircle1.getHeight()/2); - cyberCircle1.setColor(0.8f,0.8f,0.8f,0.7f); - cyberCircle1.addAction(Actions.forever(Actions.rotateBy(360f, 10f))); - cyberCircle1.setPosition(Gdx.graphics.getWidth()-cyberCircle1.getWidth()/2-10, -cyberCircle1.getHeight()*2/4f); - stage.addActor(cyberCircle1); - - analyzePage = new AnalyzePage(core.getDefaultSkin(), cameraTarget, core.getAssetManager()); - analyzePage.setPosition(1f*Gdx.graphics.getWidth(), 0); - stage.addActor(analyzePage); - - //draw music selector - musicSelection = new MusicSelectionPage(core, mainMenu); - musicSelection.addListener(this); - stage.addActor(musicSelection); - musicSelection.beginMusicSearch(); - + cameraPos = new Vector3(); } @Override public void render(float delta) { - Gdx.gl.glClearColor(1f, 1f, 1f, 1f); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); - stage.getViewport().apply(); - stage.act(); - stage.draw(); - - if (stage.getCamera().position.x != cameraTarget.x) { - stage.getCamera().position.lerp(cameraTarget, 0.25f); - } - - if (cameraTarget.x != 1.5f*Gdx.graphics.getWidth() && analyzePage.hasAudioData()) { - cameraTarget.x = 1.5f*Gdx.graphics.getWidth(); + if (stage.getCamera().position.x != cameraPos.x) { + stage.getCamera().position.lerp(cameraPos, 0.25f); } super.render(delta); } @Override - public void show() { - Gdx.input.setInputProcessor(stage); - super.show(); - } - - @Override - public void resize(int width, int height) { - stage.getViewport().update(width, height); - super.resize(width, height); - } - - @Override - public void dispose() { - stage.dispose(); - super.dispose(); + public void handle(MiniEvents ID) { + // TODO Auto-generated method stub + } @Override - public void handle(MiniEvents ID) { - switch (ID) { - case MUSIC_SELECTED: - analyzePage.setSong(Audio.getAudioData(musicSelection.getSelectedMusic()), musicSelection.getSelectedMusicInfo()); - break; - default: - break; - } + public void postTransition() { + // TODO Auto-generated method stub + + } + + public void setPhase(int phase) { + cameraPos.x = Gdx.graphics.getWidth()*(phase + 0.5f); } } diff --git a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java index da2849b..6a5c203 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java @@ -53,7 +53,9 @@ public class MusicSelectionPage extends Page { }); addActor(back); - loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f); + loadingWindow = new LoadingWindow(core.getDefaultSkin(), "tinted", true, core.getAssetManager(), core.prefs.getFloat("fx vol")); + + loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f); addActor(loadingWindow); loadingWindow.playOpenSound(); loadingWindow.setMovable(false); @@ -112,7 +114,7 @@ public class MusicSelectionPage extends Page { if (!selectable.isMusicInvalid()) { selectedMusic = selectable.getMusicFile(); selectedMusicInfo = selectable.getAudioInfo(); - send(MiniEvents.MUSIC_SELECTED); + miniSender.send(MiniEvents.MUSIC_SELECTED); } else { //Play "no" sound } diff --git a/core/src/zero1hd/polyjet/ui/pages/Page.java b/core/src/zero1hd/polyjet/ui/pages/Page.java index 5db93aa..870ce20 100755 --- a/core/src/zero1hd/polyjet/ui/pages/Page.java +++ b/core/src/zero1hd/polyjet/ui/pages/Page.java @@ -5,19 +5,17 @@ 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; -import com.badlogic.gdx.utils.Array; -import zero1hd.polyjet.util.MiniEvents; -import zero1hd.polyjet.util.MiniListener; +import zero1hd.polyjet.util.MiniSender; public class Page extends Group { private Label pageTitle; - private Array listeners; + public MiniSender miniSender; public Page() { setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - listeners = new Array<>(); + miniSender = new MiniSender(); setTouchable(Touchable.childrenOnly); } @@ -32,17 +30,4 @@ public class Page extends Group { public float getHeightBelowTitle() { return pageTitle.getY(); } - - public void send(MiniEvents ID) { - while (listeners.iterator().hasNext()) { - listeners.iterator().next().handle(ID); - } - } - - public void addListener(MiniListener handler) { - if (listeners == null) { - Gdx.app.log("Test", "URS STEWPID"); - } - listeners.add(handler); - } }