cleaned up code (switched to getters)

This commit is contained in:
Harrison Deng 2017-05-16 01:01:57 -05:00
parent e096444500
commit 27f2e51613
13 changed files with 133 additions and 125 deletions

View File

@ -41,9 +41,8 @@ public class Polyjet extends Game {
public static final int GAME_AREA_HEIGHT = 48; public static final int GAME_AREA_HEIGHT = 48;
public static final String VERSION = "(0.1)R1-PreAlpha"; public static final String VERSION = "(0.1)R1-PreAlpha";
public AssetManager assetManager = new AssetManager(); private AssetManager assetManager = new AssetManager();
public Skin defaultSkin = new Skin(); private Skin defaultSkin = new Skin();
public TextureAtlas buttons;
public FreeTypeFontGenerator default_fontGenerator; public FreeTypeFontGenerator default_fontGenerator;
public FreeTypeFontGenerator darktech_ldr_fontGenerator; public FreeTypeFontGenerator darktech_ldr_fontGenerator;
TextureAtlas skinAtlas; TextureAtlas skinAtlas;
@ -98,7 +97,7 @@ public class Polyjet extends Game {
public void dispose() { public void dispose() {
if (skinAtlas != null) { if (skinAtlas != null) {
skinAtlas.dispose(); skinAtlas.dispose();
defaultSkin.dispose(); getDefaultSkin().dispose();
default_fontGenerator.dispose(); default_fontGenerator.dispose();
darktech_ldr_fontGenerator.dispose(); darktech_ldr_fontGenerator.dispose();
assetManager.dispose(); assetManager.dispose();
@ -123,37 +122,38 @@ public class Polyjet extends Game {
public void generateFonts() { public void generateFonts() {
initComplete = true; initComplete = true;
defaultSkin = new Skin(); defaultSkin = new Skin();
Gdx.app.debug("Prelaunch Debug Info", "Generating fonts..."); Gdx.app.debug("Prelaunch Debug Info", "Generating fonts...");
skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class); skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class);
defaultSkin.addRegions(skinAtlas); getDefaultSkin().addRegions(skinAtlas);
defaultSkin.add("window-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { getDefaultSkin().add("window-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
{ {
size = 18; size = 18;
} }
})); }));
defaultSkin.add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { getDefaultSkin().add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
{ {
size = fontScale(0.04f); size = fontScale(0.04f);
} }
})); }));
defaultSkin.add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { getDefaultSkin().add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
{ {
size = fontScale(0.07f); size = fontScale(0.07f);
} }
})); }));
defaultSkin.add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { getDefaultSkin().add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
{ {
size = fontScale(0.085f); size = fontScale(0.085f);
} }
})); }));
defaultSkin.add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() { getDefaultSkin().add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() {
{ {
size = fontScale(0.075f); size = fontScale(0.075f);
} }
@ -162,68 +162,68 @@ public class Polyjet extends Game {
} }
public void defineSkinStyles() { public void defineSkinStyles() {
defaultSkin.add("default", Color.BLACK); getDefaultSkin().add("default", Color.BLACK);
defaultSkin.add("inverse", Color.WHITE); getDefaultSkin().add("inverse", Color.WHITE);
TextButtonStyle defaultTextButton = new TextButtonStyle(); TextButtonStyle defaultTextButton = new TextButtonStyle();
defaultTextButton.up = defaultSkin.getDrawable("default-round"); defaultTextButton.up = getDefaultSkin().getDrawable("default-round");
defaultTextButton.down = defaultSkin.getDrawable("default-round-down"); defaultTextButton.down = getDefaultSkin().getDrawable("default-round-down");
defaultTextButton.font = defaultSkin.getFont("default-font"); defaultTextButton.font = getDefaultSkin().getFont("default-font");
defaultTextButton.fontColor = defaultSkin.getColor("default"); defaultTextButton.fontColor = getDefaultSkin().getColor("default");
defaultTextButton.disabled = defaultSkin.getDrawable("default-round-disabled"); defaultTextButton.disabled = getDefaultSkin().getDrawable("default-round-disabled");
defaultSkin.add("default", defaultTextButton); getDefaultSkin().add("default", defaultTextButton);
TextButtonStyle subTextbutton = new TextButtonStyle(defaultTextButton); TextButtonStyle subTextbutton = new TextButtonStyle(defaultTextButton);
subTextbutton.font = defaultSkin.getFont("sub-font"); subTextbutton.font = getDefaultSkin().getFont("sub-font");
defaultSkin.add("sub", subTextbutton); getDefaultSkin().add("sub", subTextbutton);
TextButtonStyle textButtonLeft = new TextButtonStyle(); TextButtonStyle textButtonLeft = new TextButtonStyle();
textButtonLeft.up = defaultSkin.getDrawable("left-button"); textButtonLeft.up = getDefaultSkin().getDrawable("left-button");
textButtonLeft.down = defaultSkin.getDrawable("left-button-down"); textButtonLeft.down = getDefaultSkin().getDrawable("left-button-down");
textButtonLeft.font = defaultSkin.getFont("default-font"); textButtonLeft.font = getDefaultSkin().getFont("default-font");
textButtonLeft.fontColor = defaultSkin.getColor("default"); textButtonLeft.fontColor = getDefaultSkin().getColor("default");
defaultSkin.add("left", textButtonLeft); getDefaultSkin().add("left", textButtonLeft);
SliderStyle defaultSlider = new SliderStyle(defaultSkin.getDrawable("default-slider"), defaultSkin.getDrawable("default-slider-knob")); SliderStyle defaultSlider = new SliderStyle(getDefaultSkin().getDrawable("default-slider"), getDefaultSkin().getDrawable("default-slider-knob"));
defaultSkin.add("default-horizontal", defaultSlider); getDefaultSkin().add("default-horizontal", defaultSlider);
ButtonStyle infoButton = new ButtonStyle(); ButtonStyle infoButton = new ButtonStyle();
infoButton.up = defaultSkin.getDrawable("holo-pane"); infoButton.up = getDefaultSkin().getDrawable("holo-pane");
infoButton.down = defaultSkin.getDrawable("holo-pane-down"); infoButton.down = getDefaultSkin().getDrawable("holo-pane-down");
defaultSkin.add("info-button", infoButton); getDefaultSkin().add("info-button", infoButton);
LabelStyle defaultLabel = new LabelStyle(); LabelStyle defaultLabel = new LabelStyle();
defaultLabel.font = defaultSkin.getFont("default-font"); defaultLabel.font = getDefaultSkin().getFont("default-font");
defaultLabel.fontColor = defaultSkin.getColor("default"); defaultLabel.fontColor = getDefaultSkin().getColor("default");
defaultSkin.add("default", defaultLabel); getDefaultSkin().add("default", defaultLabel);
TextFieldStyle defaultTextField = new TextFieldStyle(defaultSkin.getFont("sub-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("cursor"), defaultSkin.getDrawable("selection"), defaultSkin.getDrawable("textfield")); TextFieldStyle defaultTextField = new TextFieldStyle(getDefaultSkin().getFont("sub-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("cursor"), getDefaultSkin().getDrawable("selection"), getDefaultSkin().getDrawable("textfield"));
defaultSkin.add("default", defaultTextField); getDefaultSkin().add("default", defaultTextField);
WindowStyle defaultWindow = new WindowStyle(defaultSkin.getFont("window-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-window")); WindowStyle defaultWindow = new WindowStyle(getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-window"));
defaultSkin.add("default", defaultWindow); getDefaultSkin().add("default", defaultWindow);
WindowStyle tintedWindow = new WindowStyle(defaultWindow); WindowStyle tintedWindow = new WindowStyle(defaultWindow);
tintedWindow.titleFontColor = defaultSkin.getColor("inverse"); tintedWindow.titleFontColor = getDefaultSkin().getColor("inverse");
tintedWindow.background = defaultSkin.getDrawable("tinted-window"); tintedWindow.background = getDefaultSkin().getDrawable("tinted-window");
defaultSkin.add("tinted", tintedWindow); getDefaultSkin().add("tinted", tintedWindow);
ListStyle defaultList = new ListStyle(defaultSkin.getFont("sub-font"), defaultSkin.getColor("inverse"), defaultSkin.getColor("default"), defaultSkin.getDrawable("selection")); ListStyle defaultList = new ListStyle(getDefaultSkin().getFont("sub-font"), getDefaultSkin().getColor("inverse"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("selection"));
defaultSkin.add("default", defaultList); getDefaultSkin().add("default", defaultList);
ScrollPaneStyle defaultScrollPane = new ScrollPaneStyle(); ScrollPaneStyle defaultScrollPane = new ScrollPaneStyle();
defaultScrollPane.vScroll = defaultSkin.getDrawable("default-scroll"); defaultScrollPane.vScroll = getDefaultSkin().getDrawable("default-scroll");
defaultScrollPane.hScrollKnob = defaultSkin.getDrawable("default-round-large"); defaultScrollPane.hScrollKnob = getDefaultSkin().getDrawable("default-round-large");
defaultScrollPane.hScroll = defaultSkin.getDrawable("default-scroll"); defaultScrollPane.hScroll = getDefaultSkin().getDrawable("default-scroll");
defaultScrollPane.vScrollKnob = defaultSkin.getDrawable("default-round-large"); defaultScrollPane.vScrollKnob = getDefaultSkin().getDrawable("default-round-large");
defaultSkin.add("default", defaultScrollPane); getDefaultSkin().add("default", defaultScrollPane);
CheckBoxStyle defaultCheckBox = new CheckBoxStyle(defaultSkin.getDrawable("check-off"), defaultSkin.getDrawable("check-on"), defaultSkin.getFont("window-font"), defaultSkin.getColor("default")); CheckBoxStyle defaultCheckBox = new CheckBoxStyle(getDefaultSkin().getDrawable("check-off"), getDefaultSkin().getDrawable("check-on"), getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"));
defaultSkin.add("default", defaultCheckBox); getDefaultSkin().add("default", defaultCheckBox);
SelectBoxStyle defaultSelectBox = new SelectBoxStyle(defaultSkin.getFont("default-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-select"), defaultScrollPane, defaultList); SelectBoxStyle defaultSelectBox = new SelectBoxStyle(getDefaultSkin().getFont("default-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-select"), defaultScrollPane, defaultList);
defaultSkin.add("default", defaultSelectBox); getDefaultSkin().add("default", defaultSelectBox);
Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined."); Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined.");
} }
@ -231,7 +231,7 @@ public class Polyjet extends Game {
@Override @Override
public void resize(int width, int height) { public void resize(int width, int height) {
if (initComplete) { if (initComplete) {
defaultSkin.dispose(); getDefaultSkin().dispose();
assetManager.clear(); assetManager.clear();
prefs.putInteger("screen-width", width); prefs.putInteger("screen-width", width);
prefs.putInteger("screen-height", height); prefs.putInteger("screen-height", height);
@ -246,4 +246,12 @@ public class Polyjet extends Game {
Gdx.app.debug("Font pixel size", MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())) + "px"); 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())); return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight()));
} }
public AssetManager getAssetManager() {
return assetManager;
}
public Skin getDefaultSkin() {
return defaultSkin;
}
} }

View File

@ -24,11 +24,11 @@ public class PolyJetEntity extends Actor {
setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f); setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
polyjet = core.assetManager.get("polyjet-" + jet + ".png", Texture.class); polyjet = core.getAssetManager().get("polyjet-" + jet + ".png", Texture.class);
thrust = core.assetManager.get("standard_thrust.p", ParticleEffect.class); thrust = core.getAssetManager().get("standard_thrust.p", ParticleEffect.class);
thrust.start(); thrust.start();
teleportCloak = core.assetManager.get("teleport-cloak.p", ParticleEffect.class); teleportCloak = core.getAssetManager().get("teleport-cloak.p", ParticleEffect.class);
addAction(Actions.moveTo(getX(), 4f, 0.5f)); addAction(Actions.moveTo(getX(), 4f, 0.5f));
} }

View File

@ -58,7 +58,7 @@ public class KeyMap {
public KeyMap(Polyjet core) { public KeyMap(Polyjet core) {
keyTextures = core.assetManager.get("keyboard.atlas", TextureAtlas.class); keyTextures = core.getAssetManager().get("keyboard.atlas", TextureAtlas.class);
setKeys(Gdx.app.getPreferences("PolyJet_Controls")); setKeys(Gdx.app.getPreferences("PolyJet_Controls"));
updateKeys(); updateKeys();

View File

@ -43,11 +43,11 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
// Overlay stuff // Overlay stuff
overlay = new Stage(); overlay = new Stage();
scoreLabel = new Label("Score: 0", core.defaultSkin, "default-font", Color.WHITE); scoreLabel = new Label("Score: 0", core.getDefaultSkin(), "default-font", Color.WHITE);
scoreLabel.setPosition(25, Gdx.graphics.getHeight() - scoreLabel.getHeight() - 25); scoreLabel.setPosition(25, Gdx.graphics.getHeight() - scoreLabel.getHeight() - 25);
ImageButton pause = new ImageButton(core.defaultSkin.getDrawable("pause"), ImageButton pause = new ImageButton(core.getDefaultSkin().getDrawable("pause"),
core.defaultSkin.getDrawable("pause-down")); core.getDefaultSkin().getDrawable("pause-down"));
pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25, pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25,
Gdx.graphics.getHeight() - pause.getHeight() - 25); Gdx.graphics.getHeight() - pause.getHeight() - 25);
pause.addListener(new ChangeListener() { pause.addListener(new ChangeListener() {
@ -58,13 +58,13 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
}); });
WidgetGroup healthBar = new WidgetGroup(); WidgetGroup healthBar = new WidgetGroup();
final Image healthBarTank = new Image(core.defaultSkin.getPatch("bar-empty")); final Image healthBarTank = new Image(core.getDefaultSkin().getPatch("bar-empty"));
healthBarTank.setHeight(100); healthBarTank.setHeight(100);
healthBar.setSize(healthBarTank.getWidth(), healthBarTank.getHeight()); healthBar.setSize(healthBarTank.getWidth(), healthBarTank.getHeight());
healthBar.setPosition(Gdx.graphics.getWidth() - healthBar.getWidth() - 16, healthBar.setPosition(Gdx.graphics.getWidth() - healthBar.getWidth() - 16,
pause.getY() - healthBar.getHeight() - 32); pause.getY() - healthBar.getHeight() - 32);
Image healthBarFiller = new Image(core.defaultSkin.getPatch("bar-fill")) { Image healthBarFiller = new Image(core.getDefaultSkin().getPatch("bar-fill")) {
@Override @Override
public void act(float delta) { public void act(float delta) {
setHeight( setHeight(
@ -76,13 +76,13 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
healthBar.addActor(healthBarTank); healthBar.addActor(healthBarTank);
overlay.addActor(healthBar); overlay.addActor(healthBar);
FPSDisplay = new FPSWindow("FPS", core.defaultSkin); FPSDisplay = new FPSWindow("FPS", core.getDefaultSkin());
overlay.addActor(pause); overlay.addActor(pause);
overlay.addActor(scoreLabel); overlay.addActor(scoreLabel);
// Pause menu // Pause menu
pauseMenu = new Window("Paused", core.defaultSkin); pauseMenu = new Window("Paused", core.getDefaultSkin());
pauseMenu.add(new TextButton("resume", core.defaultSkin) { pauseMenu.add(new TextButton("resume", core.getDefaultSkin()) {
{ {
addListener(new ChangeListener() { addListener(new ChangeListener() {

View File

@ -28,9 +28,9 @@ public class LoadingScreen extends ScreenAdapter {
this.reInit = reInit; this.reInit = reInit;
stage = new Stage(new ScreenViewport()); stage = new Stage(new ScreenViewport());
core.assetManager.load("splashlogo.png", Texture.class); core.getAssetManager().load("splashlogo.png", Texture.class);
core.assetManager.finishLoading(); core.getAssetManager().finishLoading();
zero1HD = new Image(this.core.assetManager.get("splashlogo.png", Texture.class)); zero1HD = new Image(this.core.getAssetManager().get("splashlogo.png", Texture.class));
zero1HD.setColor(0f,1f,1f,0f); zero1HD.setColor(0f,1f,1f,0f);
stage.addActor(zero1HD); stage.addActor(zero1HD);
@ -50,7 +50,7 @@ public class LoadingScreen extends ScreenAdapter {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta); stage.act(delta);
if (!zero1HD.hasActions() & core.assetManager.update()) { if (!zero1HD.hasActions() & core.getAssetManager().update()) {
Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing."); Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing.");
zero1HD.remove(); zero1HD.remove();
@ -62,8 +62,8 @@ public class LoadingScreen extends ScreenAdapter {
} }
core.setScreen(gotoScreen); core.setScreen(gotoScreen);
core.assetManager.unload("splashlogo.png"); core.getAssetManager().unload("splashlogo.png");
core.assetManager.get("standard_thrust.p", ParticleEffect.class).flipY(); core.getAssetManager().get("standard_thrust.p", ParticleEffect.class).flipY();
} }
stage.draw(); stage.draw();

View File

@ -50,7 +50,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
optionsPage.setPosition(Gdx.graphics.getWidth(), 0); optionsPage.setPosition(Gdx.graphics.getWidth(), 0);
stage.addActor(optionsPage); stage.addActor(optionsPage);
creditsPage = new CreditsPage(core.defaultSkin); creditsPage = new CreditsPage(core.getDefaultSkin());
creditsPage.setPosition(0, Gdx.graphics.getHeight()); creditsPage.setPosition(0, Gdx.graphics.getHeight());
stage.addActor(creditsPage); stage.addActor(creditsPage);

View File

@ -51,7 +51,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
public void postTransition() { public void postTransition() {
stage.clear(); stage.clear();
Image cyberCircle1 = new Image(core.assetManager.get("cybercircle3B.png", Texture.class)); Image cyberCircle1 = new Image(core.getAssetManager().get("cybercircle3B.png", Texture.class));
cyberCircle1.setScale(0.7f); cyberCircle1.setScale(0.7f);
cyberCircle1.setOrigin(cyberCircle1.getWidth()/2, cyberCircle1.getHeight()/2); cyberCircle1.setOrigin(cyberCircle1.getWidth()/2, cyberCircle1.getHeight()/2);
cyberCircle1.setColor(0.8f,0.8f,0.8f,0.7f); cyberCircle1.setColor(0.8f,0.8f,0.8f,0.7f);
@ -59,7 +59,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
cyberCircle1.setPosition(Gdx.graphics.getWidth()-cyberCircle1.getWidth()/2-10, -cyberCircle1.getHeight()*2/4f); cyberCircle1.setPosition(Gdx.graphics.getWidth()-cyberCircle1.getWidth()/2-10, -cyberCircle1.getHeight()*2/4f);
stage.addActor(cyberCircle1); stage.addActor(cyberCircle1);
analyzePage = new AnalyzePage(core.defaultSkin, cameraTarget, core.assetManager); analyzePage = new AnalyzePage(core.getDefaultSkin(), cameraTarget, core.getAssetManager());
analyzePage.setPosition(1f*Gdx.graphics.getWidth(), 0); analyzePage.setPosition(1f*Gdx.graphics.getWidth(), 0);
stage.addActor(analyzePage); stage.addActor(analyzePage);

View File

@ -28,15 +28,15 @@ public class MainPage extends Page {
private WidgetGroup playButton; private WidgetGroup playButton;
public MainPage(final Polyjet core, final Vector3 targetPosition) { public MainPage(final Polyjet core, final Vector3 targetPosition) {
polyjetTitle = new Image(core.assetManager.get("PolyjetTitle.png", Texture.class)); polyjetTitle = new Image(core.getAssetManager().get("PolyjetTitle.png", Texture.class));
polyjetTitle.setPosition(15, getHeight() - polyjetTitle.getHeight()-15); polyjetTitle.setPosition(15, getHeight() - polyjetTitle.getHeight()-15);
addActor(polyjetTitle); addActor(polyjetTitle);
polyJetVersion = new Label("Version: " + Polyjet.VERSION, core.defaultSkin, "sub-font", polyJetVersion = new Label("Version: " + Polyjet.VERSION, core.getDefaultSkin(), "sub-font",
core.defaultSkin.getColor("default")); core.getDefaultSkin().getColor("default"));
polyJetVersion.setPosition(3, 3); polyJetVersion.setPosition(3, 3);
addActor(polyJetVersion); addActor(polyJetVersion);
options = new TextButton(" Options ", core.defaultSkin, "left"); options = new TextButton(" Options ", core.getDefaultSkin(), "left");
options.addListener(new ChangeListener() { options.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -48,7 +48,7 @@ public class MainPage extends Page {
options.addAction(Actions.sequence(Actions.delay(0.25f), Actions.moveTo(0, options.getY(), 0.5f))); options.addAction(Actions.sequence(Actions.delay(0.25f), Actions.moveTo(0, options.getY(), 0.5f)));
addActor(options); addActor(options);
credits = new TextButton(" Credits ", core.defaultSkin, "left"); credits = new TextButton(" Credits ", core.getDefaultSkin(), "left");
credits.addListener(new ChangeListener() { credits.addListener(new ChangeListener() {
@Override @Override
@ -60,7 +60,7 @@ public class MainPage extends Page {
credits.addAction(Actions.sequence(Actions.delay(0.5f), Actions.moveTo(0, credits.getY(), 0.5f))); credits.addAction(Actions.sequence(Actions.delay(0.5f), Actions.moveTo(0, credits.getY(), 0.5f)));
addActor(credits); addActor(credits);
quit = new TextButton(" Quit ", core.defaultSkin, "left"); quit = new TextButton(" Quit ", core.getDefaultSkin(), "left");
quit.setPosition(-quit.getWidth(), credits.getY() - credits.getHeight() - 10); quit.setPosition(-quit.getWidth(), credits.getY() - credits.getHeight() - 10);
quit.addListener(new ChangeListener() { quit.addListener(new ChangeListener() {
@ -76,14 +76,14 @@ public class MainPage extends Page {
// begin play button // begin play button
playButton = new WidgetGroup(); playButton = new WidgetGroup();
cyberCircle = new Image(core.assetManager.get("Tech-Circle1.png", Texture.class)); cyberCircle = new Image(core.getAssetManager().get("Tech-Circle1.png", Texture.class));
cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2); cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2);
cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f); cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f);
cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f))); cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f)));
playButton.addActor(cyberCircle); playButton.addActor(cyberCircle);
playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight()); playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight());
begin = new Label("Play", core.defaultSkin, "special-font", core.defaultSkin.getColor("default")); begin = new Label("Play", core.getDefaultSkin(), "special-font", core.getDefaultSkin().getColor("default"));
begin.setColor(1f, 1f, 1f, 1f); begin.setColor(1f, 1f, 1f, 1f);
playButton.addActor(begin); playButton.addActor(begin);
begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10, begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10,

View File

@ -24,7 +24,7 @@ public class MoreOptionsPage extends Page {
public MoreOptionsPage(Polyjet core, final Vector3 targetLocation) { public MoreOptionsPage(Polyjet core, final Vector3 targetLocation) {
keymap = new KeyMap(core); keymap = new KeyMap(core);
TextButton backArrow = new TextButton("Back", core.defaultSkin); TextButton backArrow = new TextButton("Back", core.getDefaultSkin());
backArrow.setPosition(15, getHeight()-backArrow.getHeight()-10); backArrow.setPosition(15, getHeight()-backArrow.getHeight()-10);
backArrow.addListener(new ChangeListener() { backArrow.addListener(new ChangeListener() {
@Override @Override
@ -34,16 +34,16 @@ public class MoreOptionsPage extends Page {
}); });
addActor(backArrow); addActor(backArrow);
controlSetter = new SetControls(core.defaultSkin, keymap); controlSetter = new SetControls(core.getDefaultSkin(), keymap);
controlsScroller = new ScrollPane(controlSetter, core.defaultSkin); controlsScroller = new ScrollPane(controlSetter, core.getDefaultSkin());
controlsScroller.setFadeScrollBars(false); controlsScroller.setFadeScrollBars(false);
controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
controlsScroller.setX(backArrow.getWidth()+10+backArrow.getX()); controlsScroller.setX(backArrow.getWidth()+10+backArrow.getX());
addActor(controlsScroller); addActor(controlsScroller);
controlsScroller.setVisible(false); controlsScroller.setVisible(false);
graphicsSettings = new GraphicsTable(core.defaultSkin, core.prefs); graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.prefs);
graphicsScroller = new ScrollPane(graphicsSettings, core.defaultSkin); graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin());
graphicsScroller.setFadeScrollBars(false); graphicsScroller.setFadeScrollBars(false);
graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
graphicsScroller.setX(backArrow.getWidth()+10+backArrow.getX()); graphicsScroller.setX(backArrow.getWidth()+10+backArrow.getX());

View File

@ -34,14 +34,14 @@ public class MusicSelectionPage extends Page {
private AnalyzePage ap; private AnalyzePage ap;
public MusicSelectionPage(final Polyjet core, final MainMenu mainMenu, AnalyzePage analyzePage) { public MusicSelectionPage(final Polyjet core, final MainMenu mainMenu, AnalyzePage analyzePage) {
super("Select music", core.defaultSkin); super("Select music", core.getDefaultSkin());
this.core = core; this.core = core;
musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation"); musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
this.ap = analyzePage; this.ap = analyzePage;
back = new TextButton("Back", core.defaultSkin); back = new TextButton("Back", core.getDefaultSkin());
back.setPosition(getWidth()-back.getWidth()-15f, getHeightBelowTitle()); back.setPosition(getWidth()-back.getWidth()-15f, getHeightBelowTitle());
back.addListener(new ChangeListener() { back.addListener(new ChangeListener() {
@Override @Override
@ -52,7 +52,7 @@ public class MusicSelectionPage extends Page {
}); });
addActor(back); addActor(back);
loadingWindow = new LoadingWindow(core.defaultSkin, "tinted", true, core.assetManager, core.prefs.getFloat("fx vol")); loadingWindow = new LoadingWindow(core.getDefaultSkin(), "tinted", true, core.getAssetManager(), core.prefs.getFloat("fx vol"));
loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f); loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f);
addActor(loadingWindow); addActor(loadingWindow);
loadingWindow.playOpenSound(); loadingWindow.playOpenSound();
@ -97,7 +97,7 @@ public class MusicSelectionPage extends Page {
if (musicFiles.length > 0) { if (musicFiles.length > 0) {
for (int music = 0; music < musicFiles.length && !cancel; music++) { for (int music = 0; music < musicFiles.length && !cancel; music++) {
final MusicSelectable selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, core.defaultSkin, core.assetManager.get("defaultCover.png", Texture.class)); final MusicSelectable selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, core.getDefaultSkin(), core.getAssetManager().get("defaultCover.png", Texture.class));
Gdx.app.postRunnable(new Runnable() { Gdx.app.postRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -123,7 +123,7 @@ public class MusicSelectionPage extends Page {
loadingWindow.remove(); loadingWindow.remove();
} else { } else {
NoticeWindow notice = new NoticeWindow(core.defaultSkin, "default", "No song's found in:\n\"" + core.prefs.getString("music dir") + "\"\nTo change the search directory, go to game options."); NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.prefs.getString("music dir") + "\"\nTo change the search directory, go to game options.");
notice.setSize(0.6f*getWidth(), 0.6f*getHeight()); notice.setSize(0.6f*getWidth(), 0.6f*getHeight());
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f); notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
notice.setModal(true); notice.setModal(true);

View File

@ -32,17 +32,17 @@ public class OptionsPage extends Page {
this.core = core; this.core = core;
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left(); optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
Label optionGeneralTitle = new Label("General", core.defaultSkin, "large-font", core.defaultSkin.getColor("default")); Label optionGeneralTitle = new Label("General", core.getDefaultSkin(), "large-font", core.getDefaultSkin().getColor("default"));
optionsTable.add(optionGeneralTitle).left().spaceBottom(10f); optionsTable.add(optionGeneralTitle).left().spaceBottom(10f);
optionsTable.row(); optionsTable.row();
Label musicVolSliderLabel = new Label("Music Volume: ", core.defaultSkin); Label musicVolSliderLabel = new Label("Music Volume: ", core.getDefaultSkin());
optionsTable.add(musicVolSliderLabel).padRight(12f).left(); optionsTable.add(musicVolSliderLabel).padRight(12f).left();
musicVolSlider = new Slider(0, 100, 0.1f, false, core.defaultSkin); musicVolSlider = new Slider(0, 100, 0.1f, false, core.getDefaultSkin());
musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f)); musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f));
optionsTable.add(musicVolSlider).prefWidth(790).left(); optionsTable.add(musicVolSlider).prefWidth(790).left();
final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.defaultSkin); final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.getDefaultSkin());
musicVolSlider.addListener(new ChangeListener() { musicVolSlider.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -53,12 +53,12 @@ public class OptionsPage extends Page {
optionsTable.row(); optionsTable.row();
Label fxVolSliderLabel = new Label("FX Volume: ", core.defaultSkin); Label fxVolSliderLabel = new Label("FX Volume: ", core.getDefaultSkin());
optionsTable.add(fxVolSliderLabel).padRight(12f).left(); optionsTable.add(fxVolSliderLabel).padRight(12f).left();
fxVolSlider = new Slider(0, 100, 1, false, core.defaultSkin); fxVolSlider = new Slider(0, 100, 1, false, core.getDefaultSkin());
fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f)); fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f));
optionsTable.add(fxVolSlider).prefWidth(790); optionsTable.add(fxVolSlider).prefWidth(790);
final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.defaultSkin); final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.getDefaultSkin());
fxVolSlider.addListener(new ChangeListener() { fxVolSlider.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -70,17 +70,17 @@ public class OptionsPage extends Page {
optionsTable.row(); optionsTable.row();
Label musicDirectoryLabel = new Label("Music Directory: ", core.defaultSkin); Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin());
optionsTable.add(musicDirectoryLabel).left(); optionsTable.add(musicDirectoryLabel).left();
directoryField = new TextField(null, core.defaultSkin); directoryField = new TextField(null, core.getDefaultSkin());
directoryField.setText(core.prefs.getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music")); directoryField.setText(core.prefs.getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music"));
optionsTable.add(directoryField).prefWidth(810).left(); optionsTable.add(directoryField).prefWidth(810).left();
optionsTable.row(); optionsTable.row();
Label debugCodeLabel = new Label("Debug Code: ", core.defaultSkin); Label debugCodeLabel = new Label("Debug Code: ", core.getDefaultSkin());
optionsTable.add(debugCodeLabel).left(); optionsTable.add(debugCodeLabel).left();
final TextField debugCodeField = new TextField(null, core.defaultSkin); final TextField debugCodeField = new TextField(null, core.getDefaultSkin());
debugCodeField.addListener(new InputListener() { debugCodeField.addListener(new InputListener() {
@Override @Override
public boolean keyUp(InputEvent event, int keycode) { public boolean keyUp(InputEvent event, int keycode) {
@ -100,7 +100,7 @@ public class OptionsPage extends Page {
//Back button //Back button
TextButton backButton = new TextButton("Back", core.defaultSkin); TextButton backButton = new TextButton("Back", core.getDefaultSkin());
backButton.addListener(new ChangeListener() { backButton.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -116,7 +116,7 @@ public class OptionsPage extends Page {
optionsTable.row(); optionsTable.row();
TextButton keybindSettings = new TextButton("Set Controls", core.defaultSkin); TextButton keybindSettings = new TextButton("Set Controls", core.getDefaultSkin());
keybindSettings.addListener(new ChangeListener() { keybindSettings.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -128,7 +128,7 @@ public class OptionsPage extends Page {
optionsTable.row(); optionsTable.row();
TextButton graphicsSettings = new TextButton("Graphics", core.defaultSkin); TextButton graphicsSettings = new TextButton("Graphics", core.getDefaultSkin());
graphicsSettings.addListener(new ChangeListener() { graphicsSettings.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -150,7 +150,7 @@ public class OptionsPage extends Page {
@Override @Override
public void act(float delta) { public void act(float delta) {
if (core.assetManager.update() && goToScreen != 0) { if (core.getAssetManager().update() && goToScreen != 0) {
switch (goToScreen) { switch (goToScreen) {
case 1: case 1:
core.setScreen(new CreativeDebugScreen(core, (MainMenu) core.getScreen())); core.setScreen(new CreativeDebugScreen(core, (MainMenu) core.getScreen()));

View File

@ -42,16 +42,16 @@ public class CreativeStage extends Stage {
public CreativeStage(final Polyjet core, final MainMenu mainMenu) { public CreativeStage(final Polyjet core, final MainMenu mainMenu) {
this.core = core; this.core = core;
analyzer = new AudioAnalyzer(); analyzer = new AudioAnalyzer();
musicSelector = new MusicSelector("Select Audio File", core.defaultSkin, core.prefs.getString("music dir"), "default"); musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.prefs.getString("music dir"), "default");
musicSelector.postInit(); musicSelector.postInit();
musicSelector.refresh(); musicSelector.refresh();
fpsViewer = new FPSWindow("FPS", core.defaultSkin); fpsViewer = new FPSWindow("FPS", core.getDefaultSkin());
beatViewer = new BeatViewer("Beat", core.defaultSkin, core, analyzer); beatViewer = new BeatViewer("Beat", core.getDefaultSkin(), core, analyzer);
graphViewer = new GraphWindow("Peak Values", core.defaultSkin); graphViewer = new GraphWindow("Peak Values", core.getDefaultSkin());
volumeWindow = new VolumeWindow("Volume adjustments", core.defaultSkin, core.prefs); volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.prefs);
//Back button //Back button
TextButton backButton = new TextButton("Back", core.defaultSkin); TextButton backButton = new TextButton("Back", core.getDefaultSkin());
backButton.addListener(new ChangeListener() { backButton.addListener(new ChangeListener() {
@Override @Override
@ -64,13 +64,13 @@ public class CreativeStage extends Stage {
addActor(backButton); addActor(backButton);
toolbox = new Window("Tools", core.defaultSkin); toolbox = new Window("Tools", core.getDefaultSkin());
toolbox.defaults().pad(5f); toolbox.defaults().pad(5f);
Table toolboxToolSet = new Table(core.defaultSkin); Table toolboxToolSet = new Table(core.getDefaultSkin());
toolboxToolSet.defaults().space(5f); toolboxToolSet.defaults().space(5f);
final CheckBox musicSelectorCheckbox = new CheckBox(" Music selector", core.defaultSkin); final CheckBox musicSelectorCheckbox = new CheckBox(" Music selector", core.getDefaultSkin());
musicSelectorCheckbox.addListener(new ChangeListener() { musicSelectorCheckbox.addListener(new ChangeListener() {
@Override @Override
@ -85,7 +85,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(musicSelectorCheckbox); toolboxToolSet.add(musicSelectorCheckbox);
toolboxToolSet.row(); toolboxToolSet.row();
final CheckBox musicPlayBackCheckbox = new CheckBox(" Playback controls", core.defaultSkin); final CheckBox musicPlayBackCheckbox = new CheckBox(" Playback controls", core.getDefaultSkin());
musicPlayBackCheckbox.addListener(new ChangeListener() { musicPlayBackCheckbox.addListener(new ChangeListener() {
@Override @Override
@ -100,7 +100,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(musicPlayBackCheckbox); toolboxToolSet.add(musicPlayBackCheckbox);
toolboxToolSet.row(); toolboxToolSet.row();
final CheckBox beatViewerCheckbox = new CheckBox(" Beat viewer", core.defaultSkin); final CheckBox beatViewerCheckbox = new CheckBox(" Beat viewer", core.getDefaultSkin());
beatViewerCheckbox.addListener(new ChangeListener() { beatViewerCheckbox.addListener(new ChangeListener() {
@Override @Override
@ -115,7 +115,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(beatViewerCheckbox); toolboxToolSet.add(beatViewerCheckbox);
toolboxToolSet.row(); toolboxToolSet.row();
final CheckBox fpsViewerCheckbox = new CheckBox(" FPS", core.defaultSkin); final CheckBox fpsViewerCheckbox = new CheckBox(" FPS", core.getDefaultSkin());
fpsViewerCheckbox.addListener(new ChangeListener() { fpsViewerCheckbox.addListener(new ChangeListener() {
@Override @Override
@ -130,7 +130,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(fpsViewerCheckbox); toolboxToolSet.add(fpsViewerCheckbox);
toolboxToolSet.row(); toolboxToolSet.row();
final CheckBox peakGraphCheckbox = new CheckBox(" Peak Graph", core.defaultSkin); final CheckBox peakGraphCheckbox = new CheckBox(" Peak Graph", core.getDefaultSkin());
peakGraphCheckbox.addListener(new ChangeListener() { peakGraphCheckbox.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -145,7 +145,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(peakGraphCheckbox); toolboxToolSet.add(peakGraphCheckbox);
toolboxToolSet.row(); toolboxToolSet.row();
final CheckBox volumeMixerCheckbox = new CheckBox(" Volume", core.defaultSkin); final CheckBox volumeMixerCheckbox = new CheckBox(" Volume", core.getDefaultSkin());
volumeMixerCheckbox.addListener(new ChangeListener() { volumeMixerCheckbox.addListener(new ChangeListener() {
@Override @Override
@ -160,7 +160,7 @@ public class CreativeStage extends Stage {
toolboxToolSet.add(volumeMixerCheckbox); toolboxToolSet.add(volumeMixerCheckbox);
ScrollPane scroller = new ScrollPane(toolboxToolSet, core.defaultSkin); ScrollPane scroller = new ScrollPane(toolboxToolSet, core.getDefaultSkin());
toolbox.add(scroller).expand().fill(); toolbox.add(scroller).expand().fill();
toolbox.setSize(300, 300); toolbox.setSize(300, 300);
addActor(toolbox); addActor(toolbox);

View File

@ -32,11 +32,11 @@ public class BeatViewer extends Window {
WidgetGroup bassBar = new WidgetGroup(); WidgetGroup bassBar = new WidgetGroup();
final Image bgBassBar = new Image(core.defaultSkin.getPatch("bar-empty")); final Image bgBassBar = new Image(core.getDefaultSkin().getPatch("bar-empty"));
bgBassBar.setHeight(50f); bgBassBar.setHeight(50f);
bassBar.setSize(bgBassBar.getWidth(), bgBassBar.getHeight()); bassBar.setSize(bgBassBar.getWidth(), bgBassBar.getHeight());
final Image bassBarFill = new Image(core.defaultSkin.getPatch("bar-fill")) { final Image bassBarFill = new Image(core.getDefaultSkin().getPatch("bar-fill")) {
@Override @Override
public void act(float delta) { public void act(float delta) {
if (musicReady && data.getBassPeaks().get(songIndex) >= 1f) { if (musicReady && data.getBassPeaks().get(songIndex) >= 1f) {
@ -52,10 +52,10 @@ public class BeatViewer extends Window {
add(bassBar).minSize(bassBar.getWidth(), bassBar.getHeight()); add(bassBar).minSize(bassBar.getWidth(), bassBar.getHeight());
WidgetGroup UMBar = new WidgetGroup(); WidgetGroup UMBar = new WidgetGroup();
final Image bgUMBar = new Image(core.defaultSkin.getPatch("bar-empty")); final Image bgUMBar = new Image(core.getDefaultSkin().getPatch("bar-empty"));
bgUMBar.setHeight(50f); bgUMBar.setHeight(50f);
UMBar.setSize(bgUMBar.getWidth(), bgUMBar.getHeight()); UMBar.setSize(bgUMBar.getWidth(), bgUMBar.getHeight());
Image UMBarFill = new Image(core.defaultSkin.getPatch("bar-fill")) { Image UMBarFill = new Image(core.getDefaultSkin().getPatch("bar-fill")) {
@Override @Override
public void act(float delta) { public void act(float delta) {
if (musicReady && data.getUMPeaks().get(songIndex) >= 1f) { if (musicReady && data.getUMPeaks().get(songIndex) >= 1f) {