gradient effect for gutters

This commit is contained in:
Harrison Deng 2017-07-22 21:59:56 -05:00
parent 99e6fe9c3f
commit 8af157567f
7 changed files with 43 additions and 30 deletions

View File

@ -1,22 +0,0 @@
foespritesheet.png
size: 512, 512
format: RGBA8888
filter: Linear,Linear
repeat: none
bar-beat
rotate: false
xy: 1, 1
size: 2, 4
split: 1, 1, 0, 0
orig: 2, 4
offset: 0, 0
index: -1
black-hole
rotate: false
xy: 4, 1
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -319,3 +319,19 @@ large-pane
orig: 9, 27 orig: 9, 27
offset: 0, 0 offset: 0, 0
index: -1 index: -1
grad-dark-light
rotate: false
xy: 26, 7
size: 3, 3
split: 0, 0, 0, 0
orig: 3, 3
offset: 0, 0
index: -1
grad-light-dark
rotate: false
xy: 30, 7
size: 3, 3
split: 0, 0, 0, 0
orig: 3, 3
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -43,7 +43,7 @@ public class GameScreen extends ScreenAdapter {
gameArea = new GamePlayArea(polyJet.getAssetManager(), core.getPrefs()); gameArea = new GamePlayArea(polyJet.getAssetManager(), core.getPrefs());
gameArea.setAudioMap(gpm); 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 = new InputMultiplexer();
inputs.addProcessor(gameHUD); inputs.addProcessor(gameHUD);
@ -64,10 +64,8 @@ public class GameScreen extends ScreenAdapter {
@Override @Override
public void render(float delta) { 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.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
// Gdx.gl.glLineWidth(1f);
gameArea.getViewport().apply(); gameArea.getViewport().apply();
gameArea.draw(); gameArea.draw();

View File

@ -17,8 +17,8 @@ public class HealthBar extends WidgetGroup {
empty = new Image(skin.getPatch("bar-empty")); empty = new Image(skin.getPatch("bar-empty"));
filled = new Image(skin.getPatch("bar-fill")); filled = new Image(skin.getPatch("bar-fill"));
addActor(empty);
addActor(filled); addActor(filled);
addActor(empty);
this.maxHealth = maxHealth; this.maxHealth = maxHealth;

View File

@ -4,6 +4,7 @@ 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.g2d.NinePatch;
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.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
@ -25,10 +26,18 @@ public class GameHUD extends Stage {
private Music music; 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(); super();
this.music = music; 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 = new Label("Score: 0", skin, "default-font", Color.WHITE);
score.setPosition(10f, Gdx.graphics.getHeight()-score.getHeight() - 10f); score.setPosition(10f, Gdx.graphics.getHeight()-score.getHeight() - 10f);
addActor(score); addActor(score);
@ -47,7 +56,6 @@ public class GameHUD extends Stage {
fpsWindow = new FPSWindow("FPS", skin); fpsWindow = new FPSWindow("FPS", skin);
fpsWindow.setPosition(15f, 15f); fpsWindow.setPosition(15f, 15f);
addActor(fpsWindow);
pauseMenu = new PauseMenu(skin); pauseMenu = new PauseMenu(skin);
pauseMenu.getResumeButton().addListener(new ChangeListener() { pauseMenu.getResumeButton().addListener(new ChangeListener() {
@ -113,7 +121,11 @@ public class GameHUD extends Stage {
public boolean keyUp(int keycode) { public boolean keyUp(int keycode) {
switch (keycode) { switch (keycode) {
case Keys.F3: case Keys.F3:
if (fpsWindow.hasParent()) {
fpsWindow.remove();
} else {
addActor(fpsWindow); addActor(fpsWindow);
}
break; break;
case Keys.ESCAPE: case Keys.ESCAPE:
togglePause(); togglePause();
@ -123,4 +135,13 @@ public class GameHUD extends Stage {
} }
return false; 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();
}
} }