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); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.getViewport().apply(); stage.getViewport().apply();
stage.act(); try {
stage.draw(); stage.act();
stage.draw();
} catch (NullPointerException e) {
e.printStackTrace();
}
if (stage.getCamera().position.x != cameraPos.x) { if (stage.getCamera().position.x != cameraPos.x) {
stage.getCamera().position.lerp(cameraPos, 0.25f); stage.getCamera().position.lerp(cameraPos, 0.25f);

View File

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

View File

@ -126,17 +126,16 @@ public class MusicSelectionPage extends Page {
int prog = (int) (100f*music/(musicFiles.length-1f)); int prog = (int) (100f*music/(musicFiles.length-1f));
loadingWindow.setProgress(prog); loadingWindow.setProgress(prog);
} }
loadingWindow.remove();
} else { } 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()); 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.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);
notice.setMovable(false); notice.setMovable(false);
loadingWindow.remove();
addActor(notice); addActor(notice);
notice.playOpenSound(); notice.playOpenSound();
} }
loadingWindow.remove();
} }
}).start(); }).start();
} }

View File

@ -4,8 +4,10 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color; 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.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage; 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.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Skin;
@ -22,10 +24,11 @@ public class GameHUD extends Stage {
private FPSWindow fpsWindow; private FPSWindow fpsWindow;
private PauseMenu pauseMenu; private PauseMenu pauseMenu;
private HealthBar healthBar; private HealthBar healthBar;
private Image leftStatusBar;
private Image rightStatusBar;
private Music music; private Music music;
public GameHUD(Skin skin, float maxHealth) { public GameHUD(Skin skin, float maxHealth, GamePlayArea gpa) {
super(); super();
scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE); scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE);
scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f); scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f);
@ -60,6 +63,14 @@ public class GameHUD extends Stage {
healthBar.setHealth(maxHealth); healthBar.setHealth(maxHealth);
healthBar.setPosition(Gdx.graphics.getWidth()-healthBar.getWidth() -10f, (Gdx.graphics.getHeight()-healthBar.getHeight())/2f); healthBar.setPosition(Gdx.graphics.getWidth()-healthBar.getWidth() -10f, (Gdx.graphics.getHeight()-healthBar.getHeight())/2f);
addActor(healthBar); 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; public EntityManager em;
private CollisionDetector collisionDetector; private CollisionDetector collisionDetector;
private float yTeleport = RhythmBullet.GAME_AREA_HEIGHT/2;
private int score; private int score;
private ShaderProgram glowShader; private ShaderProgram glowShader;
@ -60,6 +58,7 @@ public class GamePlayArea extends Stage {
public void setAudioMap(GamePlayMap audioMap) { public void setAudioMap(GamePlayMap audioMap) {
this.audioMap = audioMap; this.audioMap = audioMap;
} }
/** /**
* needs to be called right after set as screen (should be called in show method). * needs to be called right after set as screen (should be called in show method).
* @param prefs * @param prefs
@ -88,7 +87,6 @@ public class GamePlayArea extends Stage {
fboRegion = new TextureRegion(blurTarget.getColorBufferTexture()); fboRegion = new TextureRegion(blurTarget.getColorBufferTexture());
fboRegion.flip(false, true); fboRegion.flip(false, true);
} }
ShaderProgram.pedantic = false; ShaderProgram.pedantic = false;
@ -109,12 +107,12 @@ public class GamePlayArea extends Stage {
blurTarget.end(getViewport().getScreenX(), getViewport().getScreenY(), getViewport().getScreenWidth(), getViewport().getScreenHeight()); 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_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
getBatch().setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); getBatch().setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
getBatch().begin(); getBatch().begin();
getBatch().setShader(glowShader); getBatch().setShader(glowShader);
getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT); getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
getBatch().setShader(null); getBatch().setShader(null);
getBatch().end(); getBatch().end();
} else { } else {
@ -230,10 +228,6 @@ public class GamePlayArea extends Stage {
gameHUD.setScore(score); gameHUD.setScore(score);
} }
public float getyTeleport() {
return yTeleport;
}
@Override @Override
public void dispose() { public void dispose() {
if (glowShader != null) { if (glowShader != null) {

View File

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