gradient effect for gutters
This commit is contained in:
parent
99e6fe9c3f
commit
8af157567f
@ -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 |
@ -319,3 +319,19 @@ large-pane
|
||||
orig: 9, 27
|
||||
offset: 0, 0
|
||||
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 |
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user