progressed on pre game screen
This commit is contained in:
@@ -2,6 +2,7 @@ package zero1hd.polyjet.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
@@ -36,7 +37,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
targetPosition = new Vector3(stage.getCamera().position);
|
||||
}
|
||||
|
||||
public void postTransition() {
|
||||
public Screen postTransition() {
|
||||
stage.clear();
|
||||
|
||||
mainPage = new MainPage(core, targetPosition);
|
||||
@@ -84,6 +85,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
});
|
||||
|
||||
Gdx.app.debug("Post Transition", "Beginning screen setup for Main menu.");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,12 +1,19 @@
|
||||
package zero1hd.polyjet.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
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.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.polyjet.Polyjet;
|
||||
import zero1hd.polyjet.audio.Audio;
|
||||
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;
|
||||
@@ -15,34 +22,94 @@ import zero1hd.polyjet.util.TransitionAdapter;
|
||||
public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, MiniListener {
|
||||
Stage stage;
|
||||
|
||||
Vector3 cameraPos;
|
||||
MusicSelectionPage ms;
|
||||
AnalyzePage ap;
|
||||
|
||||
public PreGameScreen(Skin skin, AssetManager assets) {
|
||||
stage = new Stage();
|
||||
cameraPos = new Vector3();
|
||||
private Vector3 cameraPos;
|
||||
|
||||
private Polyjet core;
|
||||
|
||||
public PreGameScreen(Polyjet core) {
|
||||
stage = new Stage(new ScreenViewport());
|
||||
cameraPos = new Vector3(stage.getCamera().position);
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
@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 != cameraPos.x) {
|
||||
stage.getCamera().position.lerp(cameraPos, 0.25f);
|
||||
}
|
||||
super.render(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
stage.getViewport().update(width, height);
|
||||
super.resize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(MiniEvents ID) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
switch (ID) {
|
||||
case MUSIC_SELECTED:
|
||||
cameraPos.x = 1.5f*Gdx.graphics.getWidth();
|
||||
ap.setSong(Audio.getAudioData(ms.getSelectedMusic()), ms.getSelectedMusicInfo());
|
||||
break;
|
||||
case SPECTRAL_FLUX_DONE:
|
||||
break;
|
||||
case MUSIC_DATA_CLEANED:
|
||||
break;
|
||||
case BACK:
|
||||
if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) {
|
||||
cameraPos.x = 0.5f*Gdx.graphics.getWidth();
|
||||
} else {
|
||||
core.setScreen(new MainMenu(core).postTransition());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postTransition() {
|
||||
// TODO Auto-generated method stub
|
||||
public Screen postTransition() {
|
||||
Image circle1 = new Image(core.getAssetManager().get("cybercircle1.png", Texture.class));
|
||||
circle1.setOrigin(circle1.getWidth()/2f, circle1.getHeight()/2f);
|
||||
circle1.setPosition(Gdx.graphics.getWidth(), circle1.getHeight()/3);
|
||||
stage.addActor(circle1);
|
||||
|
||||
|
||||
ms = new MusicSelectionPage(core);
|
||||
ms.miniSender.addListener(this);
|
||||
ms.beginMusicSearch();
|
||||
stage.addActor(ms);
|
||||
|
||||
ap = new AnalyzePage(core.getDefaultSkin(), core.getAssetManager());
|
||||
ap.getAudioAnalyzer().sender.addListener(this);
|
||||
ap.setPosition(Gdx.graphics.getWidth(), ap.getY());
|
||||
stage.addActor(ap);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setPhase(int phase) {
|
||||
cameraPos.x = Gdx.graphics.getWidth()*(phase + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.input.setInputProcessor(stage);
|
||||
super.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
stage.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user