cleaned up code (switched to getters)

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

View File

@@ -43,11 +43,11 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
// Overlay stuff
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);
ImageButton pause = new ImageButton(core.defaultSkin.getDrawable("pause"),
core.defaultSkin.getDrawable("pause-down"));
ImageButton pause = new ImageButton(core.getDefaultSkin().getDrawable("pause"),
core.getDefaultSkin().getDrawable("pause-down"));
pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25,
Gdx.graphics.getHeight() - pause.getHeight() - 25);
pause.addListener(new ChangeListener() {
@@ -58,13 +58,13 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
});
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);
healthBar.setSize(healthBarTank.getWidth(), healthBarTank.getHeight());
healthBar.setPosition(Gdx.graphics.getWidth() - healthBar.getWidth() - 16,
pause.getY() - healthBar.getHeight() - 32);
Image healthBarFiller = new Image(core.defaultSkin.getPatch("bar-fill")) {
Image healthBarFiller = new Image(core.getDefaultSkin().getPatch("bar-fill")) {
@Override
public void act(float delta) {
setHeight(
@@ -76,13 +76,13 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
healthBar.addActor(healthBarTank);
overlay.addActor(healthBar);
FPSDisplay = new FPSWindow("FPS", core.defaultSkin);
FPSDisplay = new FPSWindow("FPS", core.getDefaultSkin());
overlay.addActor(pause);
overlay.addActor(scoreLabel);
// Pause menu
pauseMenu = new Window("Paused", core.defaultSkin);
pauseMenu.add(new TextButton("resume", core.defaultSkin) {
pauseMenu = new Window("Paused", core.getDefaultSkin());
pauseMenu.add(new TextButton("resume", core.getDefaultSkin()) {
{
addListener(new ChangeListener() {

View File

@@ -28,9 +28,9 @@ public class LoadingScreen extends ScreenAdapter {
this.reInit = reInit;
stage = new Stage(new ScreenViewport());
core.assetManager.load("splashlogo.png", Texture.class);
core.assetManager.finishLoading();
zero1HD = new Image(this.core.assetManager.get("splashlogo.png", Texture.class));
core.getAssetManager().load("splashlogo.png", Texture.class);
core.getAssetManager().finishLoading();
zero1HD = new Image(this.core.getAssetManager().get("splashlogo.png", Texture.class));
zero1HD.setColor(0f,1f,1f,0f);
stage.addActor(zero1HD);
@@ -50,7 +50,7 @@ public class LoadingScreen extends ScreenAdapter {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
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.");
zero1HD.remove();
@@ -62,8 +62,8 @@ public class LoadingScreen extends ScreenAdapter {
}
core.setScreen(gotoScreen);
core.assetManager.unload("splashlogo.png");
core.assetManager.get("standard_thrust.p", ParticleEffect.class).flipY();
core.getAssetManager().unload("splashlogo.png");
core.getAssetManager().get("standard_thrust.p", ParticleEffect.class).flipY();
}
stage.draw();

View File

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

View File

@@ -51,7 +51,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
public void postTransition() {
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.setOrigin(cyberCircle1.getWidth()/2, cyberCircle1.getHeight()/2);
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);
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);
stage.addActor(analyzePage);