removed background per page setup in prep for consistent background for all pages

This commit is contained in:
Harrison Deng 2018-01-28 01:33:36 -06:00
parent b1f0a30f5d
commit 67b3dec906
8 changed files with 11 additions and 44 deletions

View File

@ -2,9 +2,7 @@ package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
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.Image;
@ -33,8 +31,6 @@ public class AnalysisPage extends Page {
private Image albumArt;
public AnalysisPage(Skin skin, AssetManager assets, Vector3 cameraPosition) {
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("round-grad"));
setBgColor(Color.toFloatBits(82,111,157, 255));
table = new Table();
table.setFillParent(true);
table.defaults().space(10f);

View File

@ -1,8 +1,6 @@
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
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.Skin;
@ -17,8 +15,6 @@ public class KeybindOptionsPage extends Page {
private KeyMap keyMap;
private TextButton backButton;
public KeybindOptionsPage(Skin skin, AssetManager assets, final Vector3 cameraPosition) {
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("round-grad"));
setBgColor(Color.toFloatBits(186,238,255, 255));
keyMap = new KeyMap(assets);
controlTable = new ControlOptions(skin, keyMap);

View File

@ -4,9 +4,7 @@ import java.util.Observable;
import java.util.Observer;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
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;
@ -39,8 +37,6 @@ public class MainPage extends Page implements Observer {
public MainPage(RhythmBullet core, final Vector3 targetPosition, MusicListController mlc, final MainMenu mainMenu) {
this.mlc = mlc;
setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("linear-up-grad"));
setBgColor(Color.toFloatBits(83,100,170, 255));
this.mMenu = mainMenu;
titleBar = new TitleBarVisualizer(core.getAssetManager());
addActor(titleBar);

View File

@ -8,9 +8,7 @@ import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
@ -67,8 +65,6 @@ public class MusicSelectionPage extends Page implements Observer {
private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
public MusicSelectionPage(Skin skin, MusicListController musicListController, MusicInfoController musicInfoController, AssetManager assetManager, final Vector3 cameraTarget, final AnalysisPage ap) {
setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("round-grad"));
setBgColor(Color.toFloatBits(110,164,193, 255));
this.assets = assetManager;
this.skin = skin;
this.mc = musicListController;

View File

@ -1,8 +1,6 @@
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector3;
@ -27,8 +25,6 @@ public class OptionsPage extends Page {
private float musicSearchTimer;
public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, final MusicListController sc) {
super("General", core.getDefaultSkin());
setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("round-grad"));
setBgColor(Color.toFloatBits(93,75,144, 255));
//Back button
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
backButton.addListener(new ChangeListener() {

View File

@ -1,9 +1,7 @@
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
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;
@ -12,12 +10,9 @@ import com.badlogic.gdx.utils.Disposable;
public class Page extends Group implements Disposable {
private Label pageTitle;
private TextureRegion background;
private float bgColor;
public Page() {
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
setTouchable(Touchable.childrenOnly);
bgColor = Color.toFloatBits(255, 255, 255, 255);
}
public Page(String titleText, Skin skin) {
@ -34,25 +29,13 @@ public class Page extends Group implements Disposable {
@Override
public void draw(Batch batch, float parentAlpha) {
if (background != null) {
batch.setColor(bgColor);
batch.draw(background, getX(), getY(), getWidth(), getHeight());
}
super.draw(batch, parentAlpha);
}
public void setBgColor(float bgColor) {
this.bgColor = bgColor;
}
public void addSpaceToTitle(float space) {
pageTitle.moveBy(space, 0);
}
public void setTextureBackground(TextureRegion texture) {
background = texture;
}
@Override
public void dispose() {
}

View File

@ -2,9 +2,7 @@ package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
@ -20,8 +18,6 @@ public class VideoOptionsPage extends Page {
private TextButton backButton;
public VideoOptionsPage(Skin skin, Preferences prefs, final MainMenu menu, AssetManager assets) {
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("round-grad"));
setBgColor(Color.toFloatBits(110,164,193, 255));
graphicsTable = new GraphicsOptions(menu, skin, prefs);
scrollPane = new ScrollPane(graphicsTable, skin);
scrollPane.setFadeScrollBars(false);

View File

@ -148,13 +148,14 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
Gdx.gl.glClearColor(0.22f, 0.22f, 0.22f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta);
if (blurlvl > 0) {
// Begin drawing a normal version of screen
normalBuffer.begin();
stage.getViewport().apply();
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.draw();
draw();
normalBuffer.end();
// BEGINNING NORMAL SCREEN RENDER
@ -205,9 +206,10 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
batch.end(); //STAGE BATCH ENDS HERE
} else {
stage.draw();
draw();
}
//move camera
if (stage.getCamera().position.x != cameraPosition.x || stage.getCamera().position.y != cameraPosition.y) {
stage.getCamera().position.lerp(cameraPosition, delta*lerpAlpha);
stage.getViewport().apply();
@ -215,6 +217,12 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
super.render(delta);
}
private void draw() {
//TODO draw background
stage.draw();
}
@Override
public void preAssetLoad() {
stage.clear();