begin working on status indicator

This commit is contained in:
Harrison Deng 2017-08-08 01:42:35 -05:00
parent 47c1e596d2
commit 5f8b8f95fc
7 changed files with 24 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -38,8 +38,12 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.getViewport().apply();
try {
stage.act();
stage.draw();
} catch (NullPointerException e) {
e.printStackTrace();
}
if (stage.getCamera().position.x != cameraPos.x) {
stage.getCamera().position.lerp(cameraPos, 0.25f);

View File

@ -59,7 +59,6 @@ public class AnalyzePage extends Page implements MiniListener {
private Thread mapGenThread;
private GameScreen gameScreen;
private RhythmBullet core;
public AnalyzePage(RhythmBullet core) {
super("Results", core.getDefaultSkin());

View File

@ -126,17 +126,16 @@ public class MusicSelectionPage extends Page {
int prog = (int) (100f*music/(musicFiles.length-1f));
loadingWindow.setProgress(prog);
}
loadingWindow.remove();
} else {
NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.getPrefs().getString("music dir") + "\"\nTo change the search directory, go to game options.", core.getPrefs().getLong("fx vol"), core.getAssetManager());
notice.setSize(0.6f*getWidth(), 0.6f*getHeight());
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
notice.setModal(true);
notice.setMovable(false);
loadingWindow.remove();
addActor(notice);
notice.playOpenSound();
}
loadingWindow.remove();
}
}).start();
}

View File

@ -4,8 +4,10 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
@ -22,10 +24,11 @@ public class GameHUD extends Stage {
private FPSWindow fpsWindow;
private PauseMenu pauseMenu;
private HealthBar healthBar;
private Image leftStatusBar;
private Image rightStatusBar;
private Music music;
public GameHUD(Skin skin, float maxHealth) {
public GameHUD(Skin skin, float maxHealth, GamePlayArea gpa) {
super();
scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE);
scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f);
@ -60,6 +63,14 @@ public class GameHUD extends Stage {
healthBar.setHealth(maxHealth);
healthBar.setPosition(Gdx.graphics.getWidth()-healthBar.getWidth() -10f, (Gdx.graphics.getHeight()-healthBar.getHeight())/2f);
addActor(healthBar);
leftStatusBar = new Image(skin.getDrawable("gradient-bar"));
leftStatusBar.setSize(20f, getHeight());
leftStatusBar.setPosition(gpa.getViewport().getScreenX(), 0);
rightStatusBar = new Image(skin.getDrawable("gradient-bar"));
rightStatusBar.setSize(20f, getHeight());
rightStatusBar.setPosition(gpa.getViewport().getScreenX()+gpa.getViewport().getScreenWidth(), 0);
}
/**

View File

@ -34,8 +34,6 @@ public class GamePlayArea extends Stage {
public EntityManager em;
private CollisionDetector collisionDetector;
private float yTeleport = RhythmBullet.GAME_AREA_HEIGHT/2;
private int score;
private ShaderProgram glowShader;
@ -60,6 +58,7 @@ public class GamePlayArea extends Stage {
public void setAudioMap(GamePlayMap audioMap) {
this.audioMap = audioMap;
}
/**
* needs to be called right after set as screen (should be called in show method).
* @param prefs
@ -88,7 +87,6 @@ public class GamePlayArea extends Stage {
fboRegion = new TextureRegion(blurTarget.getColorBufferTexture());
fboRegion.flip(false, true);
}
ShaderProgram.pedantic = false;
@ -109,12 +107,12 @@ public class GamePlayArea extends Stage {
blurTarget.end(getViewport().getScreenX(), getViewport().getScreenY(), getViewport().getScreenWidth(), getViewport().getScreenHeight());
getBatch().setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
getBatch().setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
getBatch().begin();
getBatch().setShader(glowShader);
getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
getBatch().setShader(null);
getBatch().end();
} else {
@ -230,10 +228,6 @@ public class GamePlayArea extends Stage {
gameHUD.setScore(score);
}
public float getyTeleport() {
return yTeleport;
}
@Override
public void dispose() {
if (glowShader != null) {

View File

@ -11,7 +11,9 @@ public class DesktopLauncher {
config.title = "Rhythm Bullet";
config.width = 800;
config.height = 480;
config.resizable = false;
config.useHDPI = true;
System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");