diff --git a/android/assets/1280x720/star_bg.png b/android/assets/1280x720/star_bg.png index 84bf78c..81e2cbd 100755 Binary files a/android/assets/1280x720/star_bg.png and b/android/assets/1280x720/star_bg.png differ diff --git a/android/assets/1280x800/star_bg.png b/android/assets/1280x800/star_bg.png index 1e726af..c860e9c 100755 Binary files a/android/assets/1280x800/star_bg.png and b/android/assets/1280x800/star_bg.png differ diff --git a/android/assets/1366x768/star_bg.png b/android/assets/1366x768/star_bg.png index e87f500..189f4b9 100755 Binary files a/android/assets/1366x768/star_bg.png and b/android/assets/1366x768/star_bg.png differ diff --git a/android/assets/1920x1080/star_bg.png b/android/assets/1920x1080/star_bg.png index c87888c..58f87ae 100755 Binary files a/android/assets/1920x1080/star_bg.png and b/android/assets/1920x1080/star_bg.png differ diff --git a/android/assets/1920x1200/star_bg.png b/android/assets/1920x1200/star_bg.png index 9353ee1..a8d3df2 100755 Binary files a/android/assets/1920x1200/star_bg.png and b/android/assets/1920x1200/star_bg.png differ diff --git a/android/assets/2560x1440/star_bg.png b/android/assets/2560x1440/star_bg.png index 172a6da..36ca2db 100755 Binary files a/android/assets/2560x1440/star_bg.png and b/android/assets/2560x1440/star_bg.png differ diff --git a/android/assets/3840x2160/star_bg.png b/android/assets/3840x2160/star_bg.png index 5aba279..5ad9954 100755 Binary files a/android/assets/3840x2160/star_bg.png and b/android/assets/3840x2160/star_bg.png differ diff --git a/android/assets/800x480/star_bg.png b/android/assets/800x480/star_bg.png index 4f520bb..530d71c 100755 Binary files a/android/assets/800x480/star_bg.png and b/android/assets/800x480/star_bg.png differ diff --git a/android/assets/uiskin.atlas b/android/assets/uiskin.atlas index 61aca74..0fab7e0 100755 --- a/android/assets/uiskin.atlas +++ b/android/assets/uiskin.atlas @@ -318,20 +318,4 @@ large-pane split: 4, 4, 13, 13 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 \ No newline at end of file diff --git a/android/assets/uiskin.png b/android/assets/uiskin.png index 98d16ec..ad56bcc 100755 Binary files a/android/assets/uiskin.png and b/android/assets/uiskin.png differ diff --git a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java index 5d74048..e72e801 100755 --- a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java +++ b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java @@ -25,12 +25,12 @@ public class RhythmMapAlgorithm implements Runnable { private float avgSPB; private float umMax, bassMax; - private float speedMod, healthMod; + private float speedMod, healthMod, difficultyMod; private float windowPerSecond; private volatile int progress; - public RhythmMapAlgorithm(AudioAnalyzer analyzer, float speedMod, float healthMod) { + public RhythmMapAlgorithm(AudioAnalyzer analyzer, float speedMod, float healthMod, float difficultyMod) { sender = new MiniSender(); bassPeaks = analyzer.getBassPeaks(); @@ -43,6 +43,7 @@ public class RhythmMapAlgorithm implements Runnable { this.speedMod = speedMod; this.healthMod = healthMod; + this.difficultyMod = difficultyMod; umMax = analyzer.getUMMaxValue(); avgUM = analyzer.getUmAvg(); @@ -61,7 +62,7 @@ public class RhythmMapAlgorithm implements Runnable { float warningTime = map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond; float endRadius = (bassPeaks.get(index)/bassMax)*(Main.GAME_AREA_HEIGHT/4f); map.addToMap(Entities.VOID_CIRCLE, - endRadius, + endRadius, rand.nextFloat()*Main.GAME_AREA_WIDTH, rand.nextFloat()*Main.GAME_AREA_HEIGHT, endRadius/(avgSPB*0.7f), diff --git a/core/src/zero1hd/polyjet/screens/GameScreen.java b/core/src/zero1hd/polyjet/screens/GameScreen.java index ff8a6e3..d3dd6cf 100755 --- a/core/src/zero1hd/polyjet/screens/GameScreen.java +++ b/core/src/zero1hd/polyjet/screens/GameScreen.java @@ -4,6 +4,9 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputMultiplexer; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; @@ -24,6 +27,10 @@ public class GameScreen extends ScreenAdapter { private AudioData music; + SpriteBatch bgBatch; + private ShaderProgram bgShader; + private Texture background; + public GameScreen(Main polyJet, GamePlayMap gpm) { core = polyJet; @@ -43,12 +50,13 @@ public class GameScreen extends ScreenAdapter { gameArea = new GamePlayArea(polyJet.getAssetManager(), core.getPrefs()); gameArea.setAudioMap(gpm); - gameHUD = new GameHUD(polyJet.getDefaultSkin(), gpm.getPlayableClip(), gameArea.getMaxHealth(), gameArea.getViewport().getLeftGutterWidth(), gameArea.getViewport().getRightGutterWidth()); + gameHUD = new GameHUD(polyJet.getDefaultSkin(), gpm.getPlayableClip(), gameArea.getMaxHealth()); inputs = new InputMultiplexer(); inputs.addProcessor(gameHUD); inputs.addProcessor(gameArea); + background = core.getAssetManager().get("star_bg.png"); } @Override @@ -59,6 +67,24 @@ public class GameScreen extends ScreenAdapter { if (!gameHUD.isPaused()) { music.getPlaybackMusic().play(); } + + if (core.getPrefs().getBoolean("bg shader")) { + Gdx.app.debug("Shader", "using background shader"); + + bgShader = new ShaderProgram(Gdx.files.internal("shaders/bg.vsh"), Gdx.files.internal("shaders/bg.fsh")); + + if (!bgShader.isCompiled()) { + System.err.println(bgShader.getLog()); + System.exit(0); + } + if (bgShader.getLog().length()!=0) { + System.out.println(bgShader.getLog()); + } + + bgBatch = new SpriteBatch(2, bgShader); + } else { + bgBatch = new SpriteBatch(2); + } super.show(); } @@ -66,6 +92,17 @@ public class GameScreen extends ScreenAdapter { public void render(float delta) { Gdx.gl.glClearColor(0f, 0f, 0f, 0f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); + bgBatch.begin(); + if (bgShader != null) { + bgBatch.setShader(bgShader); + bgShader.setUniformf("resolution", Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + + if (music != null) { + bgShader.setUniformf("time", music.getPlaybackMusic().getPosition()); + } + } + bgBatch.draw(background, 0f, 0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + bgBatch.end(); gameArea.getViewport().apply(); gameArea.draw(); diff --git a/core/src/zero1hd/polyjet/ui/builders/HealthBar.java b/core/src/zero1hd/polyjet/ui/builders/HealthBar.java index f5c97ed..821abff 100755 --- a/core/src/zero1hd/polyjet/ui/builders/HealthBar.java +++ b/core/src/zero1hd/polyjet/ui/builders/HealthBar.java @@ -8,18 +8,19 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; public class HealthBar extends WidgetGroup { Image empty; - Image filled; + Image filler; int health; int maxHealth; public HealthBar(Skin skin, int maxHealth) { super(); - + filler = new Image(skin.getPatch("bar-fill")); + addActor(filler); + empty = new Image(skin.getPatch("bar-empty")); - filled = new Image(skin.getPatch("bar-fill")); - - addActor(filled); addActor(empty); - + + + empty.toFront(); this.maxHealth = maxHealth; } @@ -27,20 +28,20 @@ public class HealthBar extends WidgetGroup { public void setHealth(int health) { this.health = health; - filled.addAction(Actions.sizeTo(getWidth(), MathUtils.round((health/maxHealth)*getHeight()), 0.1f));; + filler.addAction(Actions.sizeTo(getWidth(), MathUtils.round((health/maxHealth)*getHeight()), 0.1f));; } @Override public void setSize(float width, float height) { empty.setSize(width, height); - filled.setSize(width, height); + filler.setSize(width, height); super.setSize(width, height); } @Override public void setWidth(float width) { empty.setWidth(width); - filled.setWidth(width); + filler.setWidth(width); super.setWidth(width); } diff --git a/core/src/zero1hd/polyjet/ui/pages/AnalyzePage.java b/core/src/zero1hd/polyjet/ui/pages/AnalyzePage.java index 00a6b63..b319fc0 100755 --- a/core/src/zero1hd/polyjet/ui/pages/AnalyzePage.java +++ b/core/src/zero1hd/polyjet/ui/pages/AnalyzePage.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.Interpolation; +import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Image; @@ -77,13 +78,13 @@ public class AnalyzePage extends Page implements MiniListener { difficultyTable.row(); - sensitivityRating = new Slider(-5f, 5f, 1f, false, skin); + sensitivityRating = new Slider(0f, 1f, 0.01f, false, skin); sensitivityRating.setValue(0f); sensitivityRating.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { - sensitivityRatingTitle.setText("Base Difficulty: " + sensitivityRating.getValue()); + sensitivityRatingTitle.setText("Base Difficulty: " + MathUtils.round(sensitivityRating.getValue()*100) +"%"); } }); @@ -260,7 +261,7 @@ public class AnalyzePage extends Page implements MiniListener { case MUSIC_DATA_CLEANED: info[3].setText("data cleaning done."); info[4].addAction(Actions.color(Color.BLACK, 0.75f)); - mapGenAlgorithm = new RhythmMapAlgorithm(audioAnalyzer, speedModifier.getValue(), healthModifier.getValue()); + mapGenAlgorithm = new RhythmMapAlgorithm(audioAnalyzer, speedModifier.getValue(), healthModifier.getValue(), sensitivityRating.getValue()); mapGenAlgorithm.getSender().addListener(this); mapGenThread = new Thread(mapGenAlgorithm); mapGenThread.start(); @@ -298,7 +299,7 @@ public class AnalyzePage extends Page implements MiniListener { private void finalizeData() { Gdx.app.debug("analyze", "confirmed data finalization."); - audioAnalyzer.runThresholdCleaning(sensitivityRating.getValue()); + audioAnalyzer.runThresholdCleaning(); info[3].setText("finalizing data..."); info[3].addAction(Actions.color(Color.BLACK, 0.75f)); } diff --git a/core/src/zero1hd/polyjet/ui/stages/CreativeHUD.java b/core/src/zero1hd/polyjet/ui/stages/CreativeHUD.java index edb93ce..0bbc983 100755 --- a/core/src/zero1hd/polyjet/ui/stages/CreativeHUD.java +++ b/core/src/zero1hd/polyjet/ui/stages/CreativeHUD.java @@ -243,11 +243,11 @@ public class CreativeHUD extends Stage implements MiniListener { analyzer.startAnalyticalThread(musicSelector.getSelectedMusic()); break; case SPECTRAL_FLUX_DONE: - analyzer.runThresholdCleaning(diffWindow.getSensitivityVal()); + analyzer.runThresholdCleaning(); break; case MUSIC_DATA_CLEANED: if (analyzer != null && analyzer.isFinalized()) { - mapGen = new RhythmMapAlgorithm(analyzer, diffWindow.getSpeedModifier(), diffWindow.getHealthModifier()); + mapGen = new RhythmMapAlgorithm(analyzer, diffWindow.getSpeedModifier(), diffWindow.getHealthModifier(), diffWindow.getSensitivityVal()); mapGen.getSender().addListener(this); Thread mapGenThread = new Thread(mapGen); mapGenThread.start(); diff --git a/core/src/zero1hd/polyjet/ui/stages/GameHUD.java b/core/src/zero1hd/polyjet/ui/stages/GameHUD.java index b80f19f..d30be95 100755 --- a/core/src/zero1hd/polyjet/ui/stages/GameHUD.java +++ b/core/src/zero1hd/polyjet/ui/stages/GameHUD.java @@ -4,7 +4,6 @@ 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; @@ -26,18 +25,10 @@ public class GameHUD extends Stage { private Music music; - private int leftLetterBox, rightLetterBox; - private NinePatch leftPatch, rightPatch; - public GameHUD(Skin skin, Music music, int maxHealth, int leftLetterBox, int rightLetterBox) { + public GameHUD(Skin skin, Music music, int maxHealth) { 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); @@ -136,12 +127,4 @@ 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(); - } } diff --git a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java index 28bbd7a..d3d9bd7 100755 --- a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java +++ b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java @@ -5,7 +5,6 @@ import com.badlogic.gdx.Preferences; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Pixmap.Format; -import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.FrameBuffer; import com.badlogic.gdx.graphics.glutils.ShaderProgram; @@ -42,12 +41,9 @@ public class GamePlayArea extends Stage { TextureRegion fboRegion; private int fboSize; - private ShaderProgram bgShader; - private Texture background; public GamePlayArea(AssetManager assetManager, Preferences prefs) { super(new FitViewport(Main.GAME_AREA_WIDTH, Main.GAME_AREA_HEIGHT)); Gdx.app.debug("Game Area", "new area created"); - background = assetManager.get("star_bg.png"); polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard"); ec = new EntityController(assetManager, prefs); @@ -90,44 +86,12 @@ public class GamePlayArea extends Stage { } - if (prefs.getBoolean("bg shader")) { - Gdx.app.debug("Shader", "using background shader"); - - bgShader = new ShaderProgram(Gdx.files.internal("shaders/bg.vsh"), Gdx.files.internal("shaders/bg.fsh")); - - if (!bgShader.isCompiled()) { - System.err.println(bgShader.getLog()); - System.exit(0); - } - if (bgShader.getLog().length()!=0) { - System.out.println(bgShader.getLog()); - } - - } else { - //TODO prepare background rendering without shader - } - ShaderProgram.pedantic = false; } @Override public void draw() { //TODO batch draw background - getBatch().begin(); - - if (bgShader != null) { - getBatch().setShader(bgShader); - bgShader.setUniformf("resolution", background.getWidth(), background.getHeight()); - - if (audioMap != null) { - bgShader.setUniformf("time", audioMap.getPlayableClip().getPosition()); - } - } - getBatch().draw(background, 0f, 0f, Main.GAME_AREA_WIDTH, Main.GAME_AREA_HEIGHT); - getBatch().end(); - - getBatch().setShader(null); - if (glowShader != null) { blurTarget.begin(); @@ -272,9 +236,6 @@ public class GamePlayArea extends Stage { blurTarget.dispose(); glowShader.dispose(); } - if (bgShader != null) { - bgShader.dispose(); - } super.dispose(); } diff --git a/core/src/zero1hd/polyjet/ui/windows/DifficultyWindow.java b/core/src/zero1hd/polyjet/ui/windows/DifficultyWindow.java index 7fc495a..24d18df 100755 --- a/core/src/zero1hd/polyjet/ui/windows/DifficultyWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/DifficultyWindow.java @@ -17,7 +17,7 @@ public class DifficultyWindow extends Window { public DifficultyWindow(Skin skin) { super("Difficulty Adjuster", skin, "tinted"); - sensitivityRating = new Slider(-5f, 5f, 1f, false, skin); + sensitivityRating = new Slider(0f, 100f, 1f, false, skin); sensitivityRating.setValue(0f); sensitivityRating.addListener(new ChangeListener() { diff --git a/core/src/zero1hd/polyjet/ui/windows/PauseMenu.java b/core/src/zero1hd/polyjet/ui/windows/PauseMenu.java index 5f56fab..85ec3e3 100755 --- a/core/src/zero1hd/polyjet/ui/windows/PauseMenu.java +++ b/core/src/zero1hd/polyjet/ui/windows/PauseMenu.java @@ -11,9 +11,9 @@ public class PauseMenu extends Window { public PauseMenu(Skin skin) { super("Paused", skin, "tinted"); - defaults().pad(35f); + defaults().pad(25f); label = new Label("Game is paused.", skin); - add(label).spaceBottom(20f); + add(label).spaceBottom(15f); row(); resumeButton = new TextButton("Resume", skin);