added gradient background to main menu

This commit is contained in:
Harrison Deng 2017-10-16 00:14:59 -05:00
parent 69f40f5468
commit 76ed2cb74a
6 changed files with 38 additions and 3 deletions

19
android/assets/gradients.atlas Executable file
View File

@ -0,0 +1,19 @@
gradients.png
size: 128,128
format: RGBA8888
filter: Linear,Linear
repeat: none
red-round
rotate: false
xy: 2, 2
size: 3, 3
orig: 3, 3
offset: 0, 0
index: -1
red-linear
rotate: false
xy: 8, 2
size: 3, 3
orig: 3, 3
offset: 0, 0
index: -1

BIN
android/assets/gradients.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,7 +1,5 @@
package zero1hd.rhythmbullet;
import java.awt.Checkbox;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
@ -193,6 +191,7 @@ public class RhythmBullet extends Game {
assetManager.load("beateffect.p", ParticleEffect.class);
assetManager.load("tpSelector.png", Texture.class);
assetManager.load("magic1.png", Texture.class);
assetManager.load("gradients.atlas", TextureAtlas.class);
}
public void generateFonts(final int height) {

View File

@ -2,6 +2,7 @@ package zero1hd.rhythmbullet.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
@ -33,6 +34,7 @@ public class MainPage extends Page implements OnDifferentSongListener {
private ScrollText scrollText;
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc) {
this.sc = sc;
setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("red-linear"));
titleBar = new TitleBarVisualizer(core.getAssetManager());
addActor(titleBar);

View File

@ -1,6 +1,9 @@
package zero1hd.rhythmbullet.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
@ -11,7 +14,7 @@ import zero1hd.rhythmbullet.util.MiniSender;
public class Page extends Group implements Disposable {
private Label pageTitle;
private TextureRegion background;
public MiniSender miniSender;
public Page() {
@ -33,10 +36,22 @@ public class Page extends Group implements Disposable {
return pageTitle.getY();
}
@Override
public void draw(Batch batch, float parentAlpha) {
if (background != null) {
batch.draw(background, 0, 0, getWidth(), getHeight());
}
super.draw(batch, parentAlpha);
}
public void addSpaceToTitle(float space) {
pageTitle.moveBy(space, 0);
}
public void setTextureBackground(TextureRegion texture) {
background = texture;
}
@Override
public void dispose() {
}