gradient effect for gutters
This commit is contained in:
@@ -43,7 +43,7 @@ public class GameScreen extends ScreenAdapter {
|
||||
|
||||
gameArea = new GamePlayArea(polyJet.getAssetManager(), core.getPrefs());
|
||||
gameArea.setAudioMap(gpm);
|
||||
gameHUD = new GameHUD(polyJet.getDefaultSkin(), gpm.getPlayableClip(), gameArea.getMaxHealth());
|
||||
gameHUD = new GameHUD(polyJet.getDefaultSkin(), gpm.getPlayableClip(), gameArea.getMaxHealth(), gameArea.getViewport().getLeftGutterWidth(), gameArea.getViewport().getRightGutterWidth());
|
||||
|
||||
inputs = new InputMultiplexer();
|
||||
inputs.addProcessor(gameHUD);
|
||||
@@ -64,10 +64,8 @@ public class GameScreen extends ScreenAdapter {
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||
// Gdx.gl.glLineWidth(1f);
|
||||
|
||||
|
||||
gameArea.getViewport().apply();
|
||||
gameArea.draw();
|
||||
|
@@ -17,8 +17,8 @@ public class HealthBar extends WidgetGroup {
|
||||
empty = new Image(skin.getPatch("bar-empty"));
|
||||
filled = new Image(skin.getPatch("bar-fill"));
|
||||
|
||||
addActor(empty);
|
||||
addActor(filled);
|
||||
addActor(empty);
|
||||
|
||||
this.maxHealth = maxHealth;
|
||||
|
||||
|
@@ -4,6 +4,7 @@ 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.g2d.NinePatch;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||
@@ -25,10 +26,18 @@ public class GameHUD extends Stage {
|
||||
|
||||
private Music music;
|
||||
|
||||
public GameHUD(Skin skin, Music music, int maxHealth) {
|
||||
private int leftLetterBox, rightLetterBox;
|
||||
private NinePatch leftPatch, rightPatch;
|
||||
public GameHUD(Skin skin, Music music, int maxHealth, int leftLetterBox, int rightLetterBox) {
|
||||
super();
|
||||
this.music = music;
|
||||
|
||||
this.leftLetterBox = leftLetterBox;
|
||||
this.rightLetterBox = rightLetterBox;
|
||||
|
||||
leftPatch = skin.getPatch("grad-dark-light");
|
||||
rightPatch = skin.getPatch("grad-light-dark");
|
||||
|
||||
score = new Label("Score: 0", skin, "default-font", Color.WHITE);
|
||||
score.setPosition(10f, Gdx.graphics.getHeight()-score.getHeight() - 10f);
|
||||
addActor(score);
|
||||
@@ -47,7 +56,6 @@ public class GameHUD extends Stage {
|
||||
|
||||
fpsWindow = new FPSWindow("FPS", skin);
|
||||
fpsWindow.setPosition(15f, 15f);
|
||||
addActor(fpsWindow);
|
||||
|
||||
pauseMenu = new PauseMenu(skin);
|
||||
pauseMenu.getResumeButton().addListener(new ChangeListener() {
|
||||
@@ -113,7 +121,11 @@ public class GameHUD extends Stage {
|
||||
public boolean keyUp(int keycode) {
|
||||
switch (keycode) {
|
||||
case Keys.F3:
|
||||
addActor(fpsWindow);
|
||||
if (fpsWindow.hasParent()) {
|
||||
fpsWindow.remove();
|
||||
} else {
|
||||
addActor(fpsWindow);
|
||||
}
|
||||
break;
|
||||
case Keys.ESCAPE:
|
||||
togglePause();
|
||||
@@ -123,4 +135,13 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
getBatch().begin();
|
||||
leftPatch.draw(getBatch(), 0, 0, leftLetterBox, Gdx.graphics.getHeight());
|
||||
rightPatch.draw(getBatch(), Gdx.graphics.getWidth()-rightLetterBox, 0, rightLetterBox, Gdx.graphics.getHeight());
|
||||
getBatch().end();
|
||||
super.draw();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user