began setup of actual game screen
BIN
android/assets/1280x720/magic1.png
Executable file
After Width: | Height: | Size: 6.8 KiB |
BIN
android/assets/1280x720/tpSelector.png
Executable file
After Width: | Height: | Size: 313 B |
BIN
android/assets/1280x800/magic1.png
Executable file
After Width: | Height: | Size: 8.1 KiB |
BIN
android/assets/1280x800/tpSelector.png
Executable file
After Width: | Height: | Size: 370 B |
BIN
android/assets/1366x768/magic1.png
Executable file
After Width: | Height: | Size: 7.5 KiB |
BIN
android/assets/1366x768/tpSelector.png
Executable file
After Width: | Height: | Size: 345 B |
BIN
android/assets/1920x1080/magic1.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
android/assets/1920x1080/tpSelector.png
Executable file
After Width: | Height: | Size: 464 B |
BIN
android/assets/1920x1200/magic1.png
Executable file
After Width: | Height: | Size: 17 KiB |
BIN
android/assets/1920x1200/tpSelector.png
Executable file
After Width: | Height: | Size: 523 B |
BIN
android/assets/2560x1440/magic1.png
Executable file
After Width: | Height: | Size: 23 KiB |
BIN
android/assets/2560x1440/tpSelector.png
Executable file
After Width: | Height: | Size: 663 B |
BIN
android/assets/3840x2160/magic1.png
Executable file
After Width: | Height: | Size: 49 KiB |
BIN
android/assets/3840x2160/tpSelector.png
Executable file
After Width: | Height: | Size: 971 B |
BIN
android/assets/800x480/magic1.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
android/assets/800x480/tpSelector.png
Executable file
After Width: | Height: | Size: 202 B |
@ -237,18 +237,18 @@ pause-down
|
|||||||
index: -1
|
index: -1
|
||||||
bar-empty
|
bar-empty
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 106, 13
|
xy: 105, 13
|
||||||
size: 26, 7
|
size: 13, 3
|
||||||
split: 0, 0, 1, 1
|
split: 0, 0, 0, 0
|
||||||
orig: 32, 32
|
orig: 13, 3
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
bar-fill
|
bar-fill
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 106, 21
|
xy: 119, 13
|
||||||
size: 26, 7
|
size: 13, 3
|
||||||
split: 0, 0, 1, 1
|
split: 1, 1, 1, 1
|
||||||
orig: 26, 7
|
orig: 13, 3
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
left-button
|
left-button
|
||||||
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.5 KiB |
@ -4,13 +4,13 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
|
|
||||||
public class AndroidLauncher extends AndroidApplication {
|
public class AndroidLauncher extends AndroidApplication {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate (Bundle savedInstanceState) {
|
protected void onCreate (Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
initialize(new Polyjet(), config);
|
initialize(new Main(), config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import zero1hd.polyjet.util.GenericFileTypeHandler;
|
|||||||
import zero1hd.polyjet.util.RoundingResolutionHandler;
|
import zero1hd.polyjet.util.RoundingResolutionHandler;
|
||||||
import zero1hd.polyjet.screens.LoadingScreen;
|
import zero1hd.polyjet.screens.LoadingScreen;
|
||||||
|
|
||||||
public class Polyjet extends Game {
|
public class Main extends Game {
|
||||||
private boolean initComplete = false;
|
private boolean initComplete = false;
|
||||||
|
|
||||||
public static final int GAME_AREA_WIDTH = 64;
|
public static final int GAME_AREA_WIDTH = 64;
|
||||||
@ -134,6 +134,8 @@ public class Polyjet extends Game {
|
|||||||
assetManager.load("explosion.ogg", Sound.class);
|
assetManager.load("explosion.ogg", Sound.class);
|
||||||
assetManager.load("disintegrate.ogg", Sound.class);
|
assetManager.load("disintegrate.ogg", Sound.class);
|
||||||
assetManager.load("explosion-s.p", ParticleEffect.class);
|
assetManager.load("explosion-s.p", ParticleEffect.class);
|
||||||
|
assetManager.load("tpSelector.png", Texture.class);
|
||||||
|
assetManager.load("magic1.png", Texture.class);
|
||||||
}
|
}
|
||||||
public void generateFonts() {
|
public void generateFonts() {
|
||||||
initComplete = true;
|
initComplete = true;
|
@ -5,7 +5,7 @@ import org.apache.commons.math3.random.MersenneTwister;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.AudioAnalyzer;
|
import zero1hd.polyjet.audio.AudioAnalyzer;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.util.MiniEvents;
|
import zero1hd.polyjet.util.MiniEvents;
|
||||||
@ -59,29 +59,29 @@ public class RhythmMapAlgorithm implements Runnable {
|
|||||||
if (bassPeaks.get(index) >= avgBass) {
|
if (bassPeaks.get(index) >= avgBass) {
|
||||||
//TODO basic void circle spawning
|
//TODO basic void circle spawning
|
||||||
float warningTime = map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond;
|
float warningTime = map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond;
|
||||||
float endRadius = (bassPeaks.get(index)/bassMax)*(Polyjet.GAME_AREA_HEIGHT/4f);
|
float endRadius = (bassPeaks.get(index)/bassMax)*(Main.GAME_AREA_HEIGHT/4f);
|
||||||
map.addToMap(Entities.VOID_CIRCLE,
|
map.addToMap(Entities.VOID_CIRCLE,
|
||||||
endRadius,
|
endRadius,
|
||||||
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
rand.nextFloat()*Main.GAME_AREA_WIDTH,
|
||||||
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
rand.nextFloat()*Main.GAME_AREA_HEIGHT,
|
||||||
endRadius/(avgSPB*0.7f),
|
endRadius/(avgSPB*0.7f),
|
||||||
warningTime
|
warningTime
|
||||||
);
|
);
|
||||||
map.resetIndex();
|
map.resetIndex();
|
||||||
}
|
}
|
||||||
if (UMPeaks.get(index) >= avgUM) {
|
if (UMPeaks.get(index) >= avgUM) {
|
||||||
int spawnLocations = (Polyjet.GAME_AREA_WIDTH-8)/8;
|
int spawnLocations = (Main.GAME_AREA_WIDTH-8)/8;
|
||||||
map.addToMap(Entities.BAR,
|
map.addToMap(Entities.BAR,
|
||||||
MathUtils.round(rand.nextFloat()*spawnLocations)*8,
|
MathUtils.round(rand.nextFloat()*spawnLocations)*8,
|
||||||
(8f/avgSPB)*speedMod);
|
(8f/avgSPB)*speedMod);
|
||||||
} else {
|
} else {
|
||||||
if (UMPeaks.get(index) != 0) {
|
if (UMPeaks.get(index) != 0) {
|
||||||
float xSpawnLocation = (rand.nextFloat()*(Polyjet.GAME_AREA_WIDTH-2))+1;
|
float xSpawnLocation = (rand.nextFloat()*(Main.GAME_AREA_WIDTH-2))+1;
|
||||||
map.addToMap(Entities.PELLET,
|
map.addToMap(Entities.PELLET,
|
||||||
xSpawnLocation,
|
xSpawnLocation,
|
||||||
Polyjet.GAME_AREA_HEIGHT-0.25f,
|
Main.GAME_AREA_HEIGHT-0.25f,
|
||||||
140*rand.nextFloat()+110f,
|
140*rand.nextFloat()+110f,
|
||||||
(Polyjet.GAME_AREA_HEIGHT/4f)/avgSPB);
|
(Main.GAME_AREA_HEIGHT/4f)/avgSPB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,7 @@ import com.badlogic.gdx.Preferences;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
|
|
||||||
public class KeyMap {
|
public class KeyMap {
|
||||||
TextureAtlas keyTextures;
|
TextureAtlas keyTextures;
|
||||||
@ -61,7 +61,7 @@ public class KeyMap {
|
|||||||
public static int accelerate;
|
public static int accelerate;
|
||||||
|
|
||||||
|
|
||||||
public KeyMap(Polyjet core) {
|
public KeyMap(Main core) {
|
||||||
keyTextures = core.getAssetManager().get("keyboard.atlas", TextureAtlas.class);
|
keyTextures = core.getAssetManager().get("keyboard.atlas", TextureAtlas.class);
|
||||||
|
|
||||||
setKeys(Gdx.app.getPreferences("PolyJet_Controls"));
|
setKeys(Gdx.app.getPreferences("PolyJet_Controls"));
|
||||||
|
@ -10,7 +10,7 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffectPool;
|
|||||||
import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect;
|
import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
|
|
||||||
public class CollisionDetector {
|
public class CollisionDetector {
|
||||||
Array<Entity> firstGroup;
|
Array<Entity> firstGroup;
|
||||||
@ -45,7 +45,7 @@ public class CollisionDetector {
|
|||||||
|
|
||||||
//Play FX;
|
//Play FX;
|
||||||
if (se.playCollideSFX() && fe.playCollideSFX()) {
|
if (se.playCollideSFX() && fe.playCollideSFX()) {
|
||||||
explosionSFX.play(prefs.getFloat("fx vol"), 1f, (fe.getX()/Polyjet.GAME_AREA_WIDTH)-0.55f);
|
explosionSFX.play(prefs.getFloat("fx vol"), 1f, (fe.getX()/Main.GAME_AREA_WIDTH)-0.55f);
|
||||||
}
|
}
|
||||||
if (se.playCollidePFX() && fe.playCollidePFX()) {
|
if (se.playCollidePFX() && fe.playCollidePFX()) {
|
||||||
PooledEffect currentPFX;
|
PooledEffect currentPFX;
|
||||||
|
@ -8,7 +8,7 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class Laser extends Entity implements Poolable {
|
|||||||
hitBox.setY(getY());
|
hitBox.setY(getY());
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
|
||||||
if (getY() > Polyjet.GAME_AREA_HEIGHT) {
|
if (getY() > Main.GAME_AREA_HEIGHT) {
|
||||||
dead = true;
|
dead = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
|||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ public class PolyJetEntity extends Entity {
|
|||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.accel = accel;
|
this.accel = accel;
|
||||||
setSize(1.5f, 1.5f);
|
setSize(1.5f, 1.5f);
|
||||||
setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
setPosition(Main.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
||||||
|
|
||||||
hitbox = new Rectangle(getX(), getY(), getWidth(), getHeight());
|
hitbox = new Rectangle(getX(), getY(), getWidth(), getHeight());
|
||||||
polyjet = assets.get("polyjet-" + jet + ".png", Texture.class);
|
polyjet = assets.get("polyjet-" + jet + ".png", Texture.class);
|
||||||
|
@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.g2d.Batch;
|
|||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class Bar extends Entity implements Poolable {
|
|||||||
|
|
||||||
public void init(float x, float rate) {
|
public void init(float x, float rate) {
|
||||||
setSize(8f, 0.5f);
|
setSize(8f, 0.5f);
|
||||||
setPosition(x, Polyjet.GAME_AREA_HEIGHT);
|
setPosition(x, Main.GAME_AREA_HEIGHT);
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
hitbox.set(getX(), getY(), getWidth(), getHeight());
|
hitbox.set(getX(), getY(), getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class Flake extends Entity implements Poolable {
|
|||||||
|
|
||||||
hitbox.setPosition(getX(), getY());
|
hitbox.setPosition(getX(), getY());
|
||||||
|
|
||||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
if (getX() > Main.GAME_AREA_WIDTH || getY() > Main.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
@ -9,7 +9,7 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class Pellet extends Entity implements Poolable {
|
|||||||
hitBox.setPosition(getX(), getY());
|
hitBox.setPosition(getX(), getY());
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
|
||||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
if (getX() > Main.GAME_AREA_WIDTH || getY() > Main.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||||
dead = true;
|
dead = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.entity.Entities;
|
import zero1hd.polyjet.entity.Entities;
|
||||||
import zero1hd.polyjet.entity.Entity;
|
import zero1hd.polyjet.entity.Entity;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class Shard extends Entity implements Poolable {
|
|||||||
moveBy(angle.x*delta*rate, angle.y*rate*delta);
|
moveBy(angle.x*delta*rate, angle.y*rate*delta);
|
||||||
hitbox.setPosition(getX(), getY());
|
hitbox.setPosition(getX(), getY());
|
||||||
|
|
||||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
if (getX() > Main.GAME_AREA_WIDTH || getY() > Main.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||||
hp = 0;
|
hp = 0;
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
@ -6,20 +6,20 @@ import com.badlogic.gdx.Preferences;
|
|||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.ui.stages.CreativeStage;
|
import zero1hd.polyjet.ui.stages.CreativeHUD;
|
||||||
import zero1hd.polyjet.ui.stages.GamePlayArea;
|
import zero1hd.polyjet.ui.stages.GamePlayArea;
|
||||||
|
|
||||||
public class CreativeDebugScreen extends ScreenAdapter {
|
public class CreativeDebugScreen extends ScreenAdapter {
|
||||||
CreativeStage creative;
|
CreativeHUD creative;
|
||||||
GamePlayArea gamePlayArea;
|
GamePlayArea gamePlayArea;
|
||||||
InputMultiplexer inputs;
|
InputMultiplexer inputs;
|
||||||
|
|
||||||
Preferences prefs;
|
Preferences prefs;
|
||||||
|
|
||||||
public CreativeDebugScreen(Polyjet core, MainMenu mainMenu) {
|
public CreativeDebugScreen(Main core, MainMenu mainMenu) {
|
||||||
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
||||||
creative = new CreativeStage(core, mainMenu, gamePlayArea);
|
creative = new CreativeHUD(core, mainMenu, gamePlayArea);
|
||||||
|
|
||||||
inputs = new InputMultiplexer(creative, gamePlayArea);
|
inputs = new InputMultiplexer(creative, gamePlayArea);
|
||||||
|
|
||||||
|
@ -1,51 +1,33 @@
|
|||||||
package zero1hd.polyjet.screens;
|
package zero1hd.polyjet.screens;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
|
||||||
import com.badlogic.gdx.InputMultiplexer;
|
import com.badlogic.gdx.InputMultiplexer;
|
||||||
import com.badlogic.gdx.InputProcessor;
|
|
||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
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.ui.Image;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.AudioData;
|
import zero1hd.polyjet.audio.AudioData;
|
||||||
import zero1hd.polyjet.audio.map.GamePlayMap;
|
import zero1hd.polyjet.audio.map.GamePlayMap;
|
||||||
|
import zero1hd.polyjet.ui.stages.GameHUD;
|
||||||
import zero1hd.polyjet.ui.stages.GamePlayArea;
|
import zero1hd.polyjet.ui.stages.GamePlayArea;
|
||||||
import zero1hd.polyjet.ui.windows.FPSWindow;
|
|
||||||
|
|
||||||
public class GameScreen extends ScreenAdapter implements InputProcessor {
|
public class GameScreen extends ScreenAdapter {
|
||||||
private GamePlayArea gameArea;
|
private GamePlayArea gameArea;
|
||||||
|
private GameHUD gameHUD;
|
||||||
|
|
||||||
public InputMultiplexer inputs;
|
public InputMultiplexer inputs;
|
||||||
|
|
||||||
public boolean paused = false;
|
public Main core;
|
||||||
private boolean debug = false;
|
|
||||||
|
|
||||||
public Polyjet core;
|
|
||||||
public Stage overlay;
|
|
||||||
private Label scoreLabel;
|
|
||||||
Window pauseMenu;
|
|
||||||
FPSWindow FPSDisplay;
|
|
||||||
|
|
||||||
private AudioData music;
|
private AudioData music;
|
||||||
|
|
||||||
public GameScreen(Polyjet polyJet, GamePlayMap gpm) {
|
public GameScreen(Main polyJet, GamePlayMap gpm) {
|
||||||
core = polyJet;
|
core = polyJet;
|
||||||
|
|
||||||
// Overlay stuff
|
// Overlay stuff
|
||||||
overlay = new Stage();
|
|
||||||
scoreLabel = new Label("Score: 0", core.getDefaultSkin(), "default-font", Color.WHITE);
|
|
||||||
scoreLabel.setPosition(25, Gdx.graphics.getHeight() - scoreLabel.getHeight() - 25);
|
|
||||||
|
|
||||||
ImageButton pause = new ImageButton(core.getDefaultSkin().getDrawable("pause"),
|
ImageButton pause = new ImageButton(core.getDefaultSkin().getDrawable("pause"),
|
||||||
core.getDefaultSkin().getDrawable("pause-down"));
|
core.getDefaultSkin().getDrawable("pause-down"));
|
||||||
pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25,
|
pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25,
|
||||||
@ -56,65 +38,27 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
|||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
WidgetGroup healthBar = new WidgetGroup();
|
music = gpm.getMusicData();
|
||||||
final Image healthBarTank = new Image(core.getDefaultSkin().getPatch("bar-empty"));
|
|
||||||
healthBarTank.setHeight(100);
|
|
||||||
healthBar.setSize(healthBarTank.getWidth(), healthBarTank.getHeight());
|
|
||||||
healthBar.setPosition(Gdx.graphics.getWidth() - healthBar.getWidth() - 16,
|
|
||||||
pause.getY() - healthBar.getHeight() - 32);
|
|
||||||
|
|
||||||
Image healthBarFiller = new Image(core.getDefaultSkin().getPatch("bar-fill")) {
|
|
||||||
@Override
|
|
||||||
public void act(float delta) {
|
|
||||||
setHeight(
|
|
||||||
((float) gameArea.getPolyjet().health / (float) gameArea.getMaxHealth()) * (healthBarTank.getHeight()));
|
|
||||||
super.act(delta);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
healthBar.addActor(healthBarFiller);
|
|
||||||
healthBar.addActor(healthBarTank);
|
|
||||||
overlay.addActor(healthBar);
|
|
||||||
|
|
||||||
FPSDisplay = new FPSWindow("FPS", core.getDefaultSkin());
|
|
||||||
overlay.addActor(pause);
|
|
||||||
overlay.addActor(scoreLabel);
|
|
||||||
|
|
||||||
// Pause menu
|
|
||||||
pauseMenu = new Window("Paused", core.getDefaultSkin());
|
|
||||||
pauseMenu.add(new TextButton("resume", core.getDefaultSkin()) {
|
|
||||||
{
|
|
||||||
addListener(new ChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
|
||||||
reBegin();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).space(20f);
|
|
||||||
pauseMenu.setModal(true);
|
|
||||||
pauseMenu.setPosition((Gdx.graphics.getWidth() - pauseMenu.getWidth()) / 2,
|
|
||||||
(Gdx.graphics.getHeight() - pauseMenu.getHeight()) / 2);
|
|
||||||
|
|
||||||
// Continue to add things to input multiplexer
|
|
||||||
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());
|
||||||
|
|
||||||
inputs = new InputMultiplexer();
|
inputs = new InputMultiplexer();
|
||||||
inputs.addProcessor(this);
|
inputs.addProcessor(gameHUD);
|
||||||
inputs.addProcessor(overlay);
|
|
||||||
inputs.addProcessor(gameArea);
|
inputs.addProcessor(gameArea);
|
||||||
|
|
||||||
if (!paused) {
|
|
||||||
music.getPlaybackMusic().play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.input.setInputProcessor(inputs);
|
Gdx.input.setInputProcessor(inputs);
|
||||||
gameArea.loadShaders(core.getPrefs());
|
gameArea.loadShaders(core.getPrefs());
|
||||||
|
|
||||||
|
if (!gameHUD.isPaused()) {
|
||||||
|
music.getPlaybackMusic().play();
|
||||||
|
}
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,22 +66,23 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
|||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||||
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);
|
// Gdx.gl.glLineWidth(1f);
|
||||||
gameArea.getViewport().apply();
|
|
||||||
|
|
||||||
|
|
||||||
|
gameArea.getViewport().apply();
|
||||||
gameArea.draw();
|
gameArea.draw();
|
||||||
|
|
||||||
overlay.getViewport().apply();
|
gameHUD.getViewport().apply();
|
||||||
overlay.draw();
|
gameHUD.draw();
|
||||||
if (!paused) {
|
if (!gameHUD.isPaused()) {
|
||||||
scoreLabel.setText("Score: " + gameArea.getScore());
|
gameHUD.setScore(gameArea.getScore());
|
||||||
gameArea.act(delta);
|
gameArea.act(delta);
|
||||||
|
|
||||||
if (gameArea.getPolyjet().isDead()) {
|
if (gameArea.getPolyjet().isDead()) {
|
||||||
end(false);
|
end(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay.act(delta);
|
gameHUD.act(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!music.getPlaybackMusic().isPlaying()) {
|
if (!music.getPlaybackMusic().isPlaying()) {
|
||||||
@ -157,102 +102,23 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
overlay.dispose();
|
gameHUD.dispose();
|
||||||
gameArea.dispose();
|
gameArea.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
gameHUD.setPaused(true);
|
||||||
|
super.pause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
gameArea.getViewport().update(width, height, true);
|
gameArea.getViewport().update(width, height, true);
|
||||||
overlay.getViewport().update(width, height, true);
|
gameHUD.getViewport().update(width, height, true);
|
||||||
|
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void pause() {
|
|
||||||
paused = true;
|
|
||||||
overlay.addActor(pauseMenu);
|
|
||||||
music.getPlaybackMusic().pause();
|
|
||||||
super.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resume() {
|
|
||||||
super.resume();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reBegin() {
|
|
||||||
paused = false;
|
|
||||||
pauseMenu.remove();
|
|
||||||
music.getPlaybackMusic().play();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean keyUp(int keycode) {
|
|
||||||
switch (keycode) {
|
|
||||||
case Keys.F3:
|
|
||||||
if (debug) {
|
|
||||||
debug = false;
|
|
||||||
for (int i = 0; i < gameArea.getActors().size; i++) {
|
|
||||||
gameArea.setDebugAll(debug);
|
|
||||||
}
|
|
||||||
FPSDisplay.remove();
|
|
||||||
} else {
|
|
||||||
debug = true;
|
|
||||||
for (int i = 0; i < gameArea.getActors().size; i++) {
|
|
||||||
gameArea.setDebugAll(debug);
|
|
||||||
}
|
|
||||||
overlay.addActor(FPSDisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Keys.ESCAPE:
|
|
||||||
if (paused) {
|
|
||||||
reBegin();
|
|
||||||
} else {
|
|
||||||
pause();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean keyTyped(char character) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mouseMoved(int screenX, int screenY) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean scrolled(int amount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean keyDown(int keycode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -12,17 +12,17 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.util.TransitionAdapter;
|
import zero1hd.polyjet.util.TransitionAdapter;
|
||||||
|
|
||||||
public class LoadingScreen extends ScreenAdapter {
|
public class LoadingScreen extends ScreenAdapter {
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
Polyjet core;
|
Main core;
|
||||||
Image zero1HD;
|
Image zero1HD;
|
||||||
Screen gotoScreen;
|
Screen gotoScreen;
|
||||||
boolean reInit;
|
boolean reInit;
|
||||||
|
|
||||||
public LoadingScreen(Polyjet core, Screen gotoScreen, boolean reInit, boolean timer) {
|
public LoadingScreen(Main core, Screen gotoScreen, boolean reInit, boolean timer) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
this.gotoScreen = gotoScreen;
|
this.gotoScreen = gotoScreen;
|
||||||
this.reInit = reInit;
|
this.reInit = reInit;
|
||||||
|
@ -12,7 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.ui.pages.CreditsPage;
|
import zero1hd.polyjet.ui.pages.CreditsPage;
|
||||||
import zero1hd.polyjet.ui.pages.MainPage;
|
import zero1hd.polyjet.ui.pages.MainPage;
|
||||||
import zero1hd.polyjet.ui.pages.MoreOptionsPage;
|
import zero1hd.polyjet.ui.pages.MoreOptionsPage;
|
||||||
@ -30,9 +30,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
private CreditsPage creditsPage;
|
private CreditsPage creditsPage;
|
||||||
private MoreOptionsPage moreOptionsPage;
|
private MoreOptionsPage moreOptionsPage;
|
||||||
|
|
||||||
private Polyjet core;
|
private Main core;
|
||||||
|
|
||||||
public MainMenu(final Polyjet core) {
|
public MainMenu(final Main core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
targetPosition = new Vector3(stage.getCamera().position);
|
targetPosition = new Vector3(stage.getCamera().position);
|
||||||
|
@ -8,7 +8,7 @@ import com.badlogic.gdx.math.Vector3;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.Audio;
|
import zero1hd.polyjet.audio.Audio;
|
||||||
import zero1hd.polyjet.ui.pages.AnalyzePage;
|
import zero1hd.polyjet.ui.pages.AnalyzePage;
|
||||||
import zero1hd.polyjet.ui.pages.MusicSelectionPage;
|
import zero1hd.polyjet.ui.pages.MusicSelectionPage;
|
||||||
@ -23,9 +23,9 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
MusicSelectionPage ms;
|
MusicSelectionPage ms;
|
||||||
AnalyzePage ap;
|
AnalyzePage ap;
|
||||||
private Vector3 cameraPos;
|
private Vector3 cameraPos;
|
||||||
private Polyjet core;
|
private Main core;
|
||||||
|
|
||||||
public PreGameScreen(Polyjet core) {
|
public PreGameScreen(Main core) {
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
cameraPos = new Vector3(stage.getCamera().position);
|
cameraPos = new Vector3(stage.getCamera().position);
|
||||||
this.core = core;
|
this.core = core;
|
||||||
@ -60,10 +60,6 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
cameraPos.x = 1.5f*Gdx.graphics.getWidth();
|
cameraPos.x = 1.5f*Gdx.graphics.getWidth();
|
||||||
ap.setSong(Audio.getAudioData(ms.getSelectedMusic()), ms.getSelectedMusicInfo(), this);
|
ap.setSong(Audio.getAudioData(ms.getSelectedMusic()), ms.getSelectedMusicInfo(), this);
|
||||||
break;
|
break;
|
||||||
case SPECTRAL_FLUX_DONE:
|
|
||||||
break;
|
|
||||||
case MUSIC_DATA_CLEANED:
|
|
||||||
break;
|
|
||||||
case BACK:
|
case BACK:
|
||||||
if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) {
|
if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) {
|
||||||
cameraPos.x = 0.5f*Gdx.graphics.getWidth();
|
cameraPos.x = 0.5f*Gdx.graphics.getWidth();
|
||||||
@ -85,7 +81,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
ms.beginMusicSearch();
|
ms.beginMusicSearch();
|
||||||
stage.addActor(ms);
|
stage.addActor(ms);
|
||||||
|
|
||||||
ap = new AnalyzePage(core.getDefaultSkin(), core.getAssetManager());
|
ap = new AnalyzePage(core);
|
||||||
ap.miniSender.addListener(this);
|
ap.miniSender.addListener(this);
|
||||||
ap.setPosition(Gdx.graphics.getWidth(), ap.getY());
|
ap.setPosition(Gdx.graphics.getWidth(), ap.getY());
|
||||||
stage.addActor(ap);
|
stage.addActor(ap);
|
||||||
|
52
core/src/zero1hd/polyjet/ui/builders/HealthBar.java
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
package zero1hd.polyjet.ui.builders;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
||||||
|
|
||||||
|
public class HealthBar extends WidgetGroup {
|
||||||
|
Image empty;
|
||||||
|
Image filled;
|
||||||
|
int health;
|
||||||
|
int maxHealth;
|
||||||
|
public HealthBar(Skin skin, int maxHealth) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
empty = new Image(skin.getPatch("bar-empty"));
|
||||||
|
filled = new Image(skin.getPatch("bar-fill"));
|
||||||
|
|
||||||
|
addActor(empty);
|
||||||
|
addActor(filled);
|
||||||
|
|
||||||
|
this.maxHealth = maxHealth;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHealth(int health) {
|
||||||
|
this.health = health;
|
||||||
|
|
||||||
|
filled.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);
|
||||||
|
super.setSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWidth(float width) {
|
||||||
|
empty.setWidth(width);
|
||||||
|
filled.setWidth(width);
|
||||||
|
super.setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHeight(float height) {
|
||||||
|
empty.setHeight(height);
|
||||||
|
super.setHeight(height);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package zero1hd.polyjet.ui.pages;
|
package zero1hd.polyjet.ui.pages;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.math.Interpolation;
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
@ -16,10 +15,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.AudioAnalyzer;
|
import zero1hd.polyjet.audio.AudioAnalyzer;
|
||||||
import zero1hd.polyjet.audio.AudioData;
|
import zero1hd.polyjet.audio.AudioData;
|
||||||
import zero1hd.polyjet.audio.AudioInfo;
|
import zero1hd.polyjet.audio.AudioInfo;
|
||||||
|
import zero1hd.polyjet.audio.map.GamePlayMap;
|
||||||
import zero1hd.polyjet.audio.map.RhythmMapAlgorithm;
|
import zero1hd.polyjet.audio.map.RhythmMapAlgorithm;
|
||||||
|
import zero1hd.polyjet.screens.GameScreen;
|
||||||
import zero1hd.polyjet.ui.builders.ScrollText;
|
import zero1hd.polyjet.ui.builders.ScrollText;
|
||||||
import zero1hd.polyjet.util.MiniEvents;
|
import zero1hd.polyjet.util.MiniEvents;
|
||||||
import zero1hd.polyjet.util.MiniListener;
|
import zero1hd.polyjet.util.MiniListener;
|
||||||
@ -53,9 +55,12 @@ public class AnalyzePage extends Page implements MiniListener {
|
|||||||
|
|
||||||
private Thread mapGenThread;
|
private Thread mapGenThread;
|
||||||
|
|
||||||
public AnalyzePage(Skin skin, AssetManager assets) {
|
|
||||||
super("Results", skin);
|
private Main core;
|
||||||
this.skin = skin;
|
public AnalyzePage(Main core) {
|
||||||
|
super("Results", core.getDefaultSkin());
|
||||||
|
this.skin = core.getDefaultSkin();
|
||||||
|
this.core = core;
|
||||||
|
|
||||||
songInfo = new Table(skin);
|
songInfo = new Table(skin);
|
||||||
songInfo.align(Align.top);
|
songInfo.align(Align.top);
|
||||||
@ -149,7 +154,7 @@ public class AnalyzePage extends Page implements MiniListener {
|
|||||||
beginTable.pack();
|
beginTable.pack();
|
||||||
addActor(beginTable);
|
addActor(beginTable);
|
||||||
|
|
||||||
loadingCircle = new Image(assets.get("cybercircle1.png", Texture.class));
|
loadingCircle = new Image(core.getAssetManager().get("cybercircle1.png", Texture.class));
|
||||||
loadingCircle.setPosition((getWidth()-loadingCircle.getWidth())/2, (getHeightBelowTitle()-loadingCircle.getHeight())/2);
|
loadingCircle.setPosition((getWidth()-loadingCircle.getWidth())/2, (getHeightBelowTitle()-loadingCircle.getHeight())/2);
|
||||||
loadingCircle.setColor(0.8f,0.8f,0.8f,0.7f);
|
loadingCircle.setColor(0.8f,0.8f,0.8f,0.7f);
|
||||||
loadingCircle.setOrigin(loadingCircle.getWidth()/2, loadingCircle.getHeight()/2);
|
loadingCircle.setOrigin(loadingCircle.getWidth()/2, loadingCircle.getHeight()/2);
|
||||||
@ -267,6 +272,21 @@ public class AnalyzePage extends Page implements MiniListener {
|
|||||||
case MAP_GENERATED:
|
case MAP_GENERATED:
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
info[5].setText("Done. Generation time: " + ((endTime - startTime)/1000f) + "s");
|
info[5].setText("Done. Generation time: " + ((endTime - startTime)/1000f) + "s");
|
||||||
|
|
||||||
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final GameScreen gameScreen = new GameScreen(core, mapGenAlgorithm.getMap());
|
||||||
|
beginButton.addListener(new ChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
core.setScreen(gameScreen);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
info[5].addAction(Actions.color(Color.BLACK, 0.75f));
|
info[5].addAction(Actions.color(Color.BLACK, 0.75f));
|
||||||
songInfo.addAction(Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight(), 0.75f, Interpolation.linear));
|
songInfo.addAction(Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight(), 0.75f, Interpolation.linear));
|
||||||
difficultyTable.addAction(Actions.sequence(Actions.delay(0.4f), Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight()-difficultyTable.getHeight()-10f,0.8f, Interpolation.linear)));
|
difficultyTable.addAction(Actions.sequence(Actions.delay(0.4f), Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight()-difficultyTable.getHeight()-10f,0.8f, Interpolation.linear)));
|
||||||
@ -282,4 +302,8 @@ public class AnalyzePage extends Page implements MiniListener {
|
|||||||
info[3].setText("finalizing data...");
|
info[3].setText("finalizing data...");
|
||||||
info[3].addAction(Actions.color(Color.BLACK, 0.75f));
|
info[3].addAction(Actions.color(Color.BLACK, 0.75f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GamePlayMap getMap() {
|
||||||
|
return mapGenAlgorithm.getMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.screens.PreGameScreen;
|
import zero1hd.polyjet.screens.PreGameScreen;
|
||||||
|
|
||||||
public class MainPage extends Page {
|
public class MainPage extends Page {
|
||||||
@ -26,11 +26,11 @@ public class MainPage extends Page {
|
|||||||
private TextButton credits;
|
private TextButton credits;
|
||||||
private WidgetGroup playButton;
|
private WidgetGroup playButton;
|
||||||
|
|
||||||
public MainPage(final Polyjet core, final Vector3 targetPosition) {
|
public MainPage(final Main core, final Vector3 targetPosition) {
|
||||||
polyjetTitle = new Image(core.getAssetManager().get("PolyjetTitle.png", Texture.class));
|
polyjetTitle = new Image(core.getAssetManager().get("PolyjetTitle.png", Texture.class));
|
||||||
polyjetTitle.setPosition(15, getHeight() - polyjetTitle.getHeight()-15);
|
polyjetTitle.setPosition(15, getHeight() - polyjetTitle.getHeight()-15);
|
||||||
addActor(polyjetTitle);
|
addActor(polyjetTitle);
|
||||||
polyJetVersion = new Label("Version: " + Polyjet.VERSION, core.getDefaultSkin(), "sub-font",
|
polyJetVersion = new Label("Version: " + Main.VERSION, core.getDefaultSkin(), "sub-font",
|
||||||
core.getDefaultSkin().getColor("default"));
|
core.getDefaultSkin().getColor("default"));
|
||||||
polyJetVersion.setPosition(3, 3);
|
polyJetVersion.setPosition(3, 3);
|
||||||
addActor(polyJetVersion);
|
addActor(polyJetVersion);
|
||||||
|
@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.controls.KeyMap;
|
import zero1hd.polyjet.controls.KeyMap;
|
||||||
import zero1hd.polyjet.ui.builders.GraphicsTable;
|
import zero1hd.polyjet.ui.builders.GraphicsTable;
|
||||||
import zero1hd.polyjet.ui.builders.SetControls;
|
import zero1hd.polyjet.ui.builders.SetControls;
|
||||||
@ -21,7 +21,7 @@ public class MoreOptionsPage extends Page {
|
|||||||
private GraphicsTable graphicsSettings;
|
private GraphicsTable graphicsSettings;
|
||||||
|
|
||||||
|
|
||||||
public MoreOptionsPage(Polyjet core, final Vector3 targetLocation) {
|
public MoreOptionsPage(Main core, final Vector3 targetLocation) {
|
||||||
keymap = new KeyMap(core);
|
keymap = new KeyMap(core);
|
||||||
|
|
||||||
TextButton backArrow = new TextButton("Back", core.getDefaultSkin());
|
TextButton backArrow = new TextButton("Back", core.getDefaultSkin());
|
||||||
|
@ -15,7 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.AudioInfo;
|
import zero1hd.polyjet.audio.AudioInfo;
|
||||||
import zero1hd.polyjet.ui.builders.MusicSelectable;
|
import zero1hd.polyjet.ui.builders.MusicSelectable;
|
||||||
import zero1hd.polyjet.ui.windows.LoadingWindow;
|
import zero1hd.polyjet.ui.windows.LoadingWindow;
|
||||||
@ -25,7 +25,7 @@ import zero1hd.polyjet.util.MiniEvents;
|
|||||||
public class MusicSelectionPage extends Page {
|
public class MusicSelectionPage extends Page {
|
||||||
private volatile Table musicChoices;
|
private volatile Table musicChoices;
|
||||||
Preferences musicFileAnnotation;
|
Preferences musicFileAnnotation;
|
||||||
private Polyjet core;
|
private Main core;
|
||||||
private volatile ScrollPane musicChoiceScroller;
|
private volatile ScrollPane musicChoiceScroller;
|
||||||
|
|
||||||
private volatile LoadingWindow loadingWindow;
|
private volatile LoadingWindow loadingWindow;
|
||||||
@ -35,7 +35,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
private FileHandle selectedMusic;
|
private FileHandle selectedMusic;
|
||||||
private AudioInfo selectedMusicInfo;
|
private AudioInfo selectedMusicInfo;
|
||||||
|
|
||||||
public MusicSelectionPage(final Polyjet core) {
|
public MusicSelectionPage(final Main core) {
|
||||||
super("Select music", core.getDefaultSkin());
|
super("Select music", core.getDefaultSkin());
|
||||||
this.core = core;
|
this.core = core;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.screens.CreativeDebugScreen;
|
import zero1hd.polyjet.screens.CreativeDebugScreen;
|
||||||
import zero1hd.polyjet.screens.MainMenu;
|
import zero1hd.polyjet.screens.MainMenu;
|
||||||
|
|
||||||
@ -25,10 +25,10 @@ public class OptionsPage extends Page {
|
|||||||
private ProgressBar musicVolSlider;
|
private ProgressBar musicVolSlider;
|
||||||
private ProgressBar fxVolSlider;
|
private ProgressBar fxVolSlider;
|
||||||
private TextField directoryField;
|
private TextField directoryField;
|
||||||
private Polyjet core;
|
private Main core;
|
||||||
|
|
||||||
private byte goToScreen;
|
private byte goToScreen;
|
||||||
public OptionsPage(final Polyjet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
public OptionsPage(final Main core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
|
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.AudioAnalyzer;
|
import zero1hd.polyjet.audio.AudioAnalyzer;
|
||||||
import zero1hd.polyjet.audio.map.RhythmMapAlgorithm;
|
import zero1hd.polyjet.audio.map.RhythmMapAlgorithm;
|
||||||
import zero1hd.polyjet.screens.MainMenu;
|
import zero1hd.polyjet.screens.MainMenu;
|
||||||
@ -28,7 +28,7 @@ import zero1hd.polyjet.ui.windows.VolumeWindow;
|
|||||||
import zero1hd.polyjet.util.MiniEvents;
|
import zero1hd.polyjet.util.MiniEvents;
|
||||||
import zero1hd.polyjet.util.MiniListener;
|
import zero1hd.polyjet.util.MiniListener;
|
||||||
|
|
||||||
public class CreativeStage extends Stage implements MiniListener {
|
public class CreativeHUD extends Stage implements MiniListener {
|
||||||
MusicController musicPlayBackControls;
|
MusicController musicPlayBackControls;
|
||||||
MusicSelector musicSelector;
|
MusicSelector musicSelector;
|
||||||
FPSWindow fpsViewer;
|
FPSWindow fpsViewer;
|
||||||
@ -43,7 +43,7 @@ public class CreativeStage extends Stage implements MiniListener {
|
|||||||
Window toolbox;
|
Window toolbox;
|
||||||
|
|
||||||
GamePlayArea gpa;
|
GamePlayArea gpa;
|
||||||
public CreativeStage(final Polyjet core, final MainMenu mainMenu, final GamePlayArea gpa) {
|
public CreativeHUD(final Main core, final MainMenu mainMenu, final GamePlayArea gpa) {
|
||||||
this.gpa = gpa;
|
this.gpa = gpa;
|
||||||
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
|
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
|
||||||
musicSelector.miniSender.addListener(this);
|
musicSelector.miniSender.addListener(this);
|
126
core/src/zero1hd/polyjet/ui/stages/GameHUD.java
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
package zero1hd.polyjet.ui.stages;
|
||||||
|
|
||||||
|
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.scenes.scene2d.Actor;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
|
import zero1hd.polyjet.ui.builders.HealthBar;
|
||||||
|
import zero1hd.polyjet.ui.windows.FPSWindow;
|
||||||
|
import zero1hd.polyjet.ui.windows.PauseMenu;
|
||||||
|
|
||||||
|
public class GameHUD extends Stage {
|
||||||
|
private Label score;
|
||||||
|
private ImageButton pause;
|
||||||
|
private boolean paused;
|
||||||
|
private FPSWindow fpsWindow;
|
||||||
|
private PauseMenu pauseMenu;
|
||||||
|
private HealthBar healthBar;
|
||||||
|
|
||||||
|
private Music music;
|
||||||
|
|
||||||
|
public GameHUD(Skin skin, Music music, int maxHealth) {
|
||||||
|
super();
|
||||||
|
this.music = music;
|
||||||
|
|
||||||
|
score = new Label("Score: 0", skin, "default-font", Color.WHITE);
|
||||||
|
score.setPosition(10f, Gdx.graphics.getHeight()-score.getHeight() - 10f);
|
||||||
|
addActor(score);
|
||||||
|
|
||||||
|
pause = new ImageButton(skin.getDrawable("pause"),
|
||||||
|
skin.getDrawable("pause-down"));
|
||||||
|
pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 15f,
|
||||||
|
Gdx.graphics.getHeight() - pause.getHeight() - 15f);
|
||||||
|
pause.addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
setPaused(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addActor(pause);
|
||||||
|
|
||||||
|
fpsWindow = new FPSWindow("FPS", skin);
|
||||||
|
fpsWindow.setPosition(15f, 15f);
|
||||||
|
addActor(fpsWindow);
|
||||||
|
|
||||||
|
pauseMenu = new PauseMenu(skin);
|
||||||
|
pauseMenu.getResumeButton().addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
setPaused(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pauseMenu.setPosition((Gdx.graphics.getWidth()-pauseMenu.getWidth())/2f, (Gdx.graphics.getHeight()-pauseMenu.getHeight())/2f);
|
||||||
|
|
||||||
|
healthBar = new HealthBar(skin, maxHealth);
|
||||||
|
healthBar.setSize(20f, Gdx.graphics.getHeight()/3);
|
||||||
|
healthBar.setHealth(maxHealth);
|
||||||
|
healthBar.setPosition(Gdx.graphics.getWidth()-healthBar.getWidth() -10f, (Gdx.graphics.getHeight()-healthBar.getHeight())/2f);
|
||||||
|
addActor(healthBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the label for scoring to the designated score
|
||||||
|
* @param score designated score
|
||||||
|
*/
|
||||||
|
public void setScore(int score) {
|
||||||
|
this.score.setText("Score: " + score);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns current score by use of substring
|
||||||
|
* @return the current score value
|
||||||
|
*/
|
||||||
|
public int getScore() {
|
||||||
|
return Integer.valueOf(score.getText().substring(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaused(boolean paused) {
|
||||||
|
if (paused) {
|
||||||
|
addActor(pauseMenu);
|
||||||
|
music.pause();
|
||||||
|
} else {
|
||||||
|
pauseMenu.remove();
|
||||||
|
music.play();
|
||||||
|
}
|
||||||
|
this.paused = paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* toggle's between the two states of paused and unpaused
|
||||||
|
* @return whatever the new game state is (true for paused)
|
||||||
|
*/
|
||||||
|
public boolean togglePause() {
|
||||||
|
if (isPaused()) {
|
||||||
|
setPaused(false);
|
||||||
|
} else {
|
||||||
|
setPaused(true);
|
||||||
|
}
|
||||||
|
return isPaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPaused() {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyUp(int keycode) {
|
||||||
|
switch (keycode) {
|
||||||
|
case Keys.F3:
|
||||||
|
addActor(fpsWindow);
|
||||||
|
break;
|
||||||
|
case Keys.ESCAPE:
|
||||||
|
togglePause();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
import zero1hd.polyjet.audio.map.EntitySpawnInfo;
|
import zero1hd.polyjet.audio.map.EntitySpawnInfo;
|
||||||
import zero1hd.polyjet.audio.map.GamePlayMap;
|
import zero1hd.polyjet.audio.map.GamePlayMap;
|
||||||
import zero1hd.polyjet.audio.map.MapWindowData;
|
import zero1hd.polyjet.audio.map.MapWindowData;
|
||||||
@ -31,8 +31,10 @@ public class GamePlayArea extends Stage {
|
|||||||
public EntityController ec;
|
public EntityController ec;
|
||||||
private CollisionDetector collisionDetector;
|
private CollisionDetector collisionDetector;
|
||||||
|
|
||||||
private float maxHealth = 100;
|
private int maxHealth = 100;
|
||||||
private float yTeleport = Polyjet.GAME_AREA_HEIGHT/2;
|
|
||||||
|
private float yTeleport = Main.GAME_AREA_HEIGHT/2;
|
||||||
|
|
||||||
private int score;
|
private int score;
|
||||||
|
|
||||||
private ShaderProgram glowShader;
|
private ShaderProgram glowShader;
|
||||||
@ -42,11 +44,8 @@ public class GamePlayArea extends Stage {
|
|||||||
|
|
||||||
private ShaderProgram bgShader;
|
private ShaderProgram bgShader;
|
||||||
private Texture background;
|
private Texture background;
|
||||||
|
|
||||||
private float time;
|
|
||||||
|
|
||||||
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
||||||
super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT));
|
super(new FitViewport(Main.GAME_AREA_WIDTH, Main.GAME_AREA_HEIGHT));
|
||||||
Gdx.app.debug("Game Area", "new area created");
|
Gdx.app.debug("Game Area", "new area created");
|
||||||
background = assetManager.get("star_bg.png");
|
background = assetManager.get("star_bg.png");
|
||||||
|
|
||||||
@ -58,10 +57,8 @@ public class GamePlayArea extends Stage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAudioMap(GamePlayMap audioMap) {
|
public void setAudioMap(GamePlayMap audioMap) {
|
||||||
time = 0;
|
|
||||||
this.audioMap = audioMap;
|
this.audioMap = audioMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* needs to be called right after set as screen (should be called in show method).
|
* needs to be called right after set as screen (should be called in show method).
|
||||||
* @param prefs
|
* @param prefs
|
||||||
@ -74,7 +71,7 @@ public class GamePlayArea extends Stage {
|
|||||||
System.err.println(glowShader.getLog());
|
System.err.println(glowShader.getLog());
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
if (glowShader.getLog().length()!=0) {
|
if (glowShader.getLog().length() != 0) {
|
||||||
System.out.println(glowShader.getLog());
|
System.out.println(glowShader.getLog());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,10 +117,13 @@ public class GamePlayArea extends Stage {
|
|||||||
|
|
||||||
if (bgShader != null) {
|
if (bgShader != null) {
|
||||||
getBatch().setShader(bgShader);
|
getBatch().setShader(bgShader);
|
||||||
bgShader.setUniformf("time", time);
|
|
||||||
bgShader.setUniformf("resolution", background.getWidth(), background.getHeight());
|
bgShader.setUniformf("resolution", background.getWidth(), background.getHeight());
|
||||||
|
|
||||||
|
if (audioMap != null) {
|
||||||
|
bgShader.setUniformf("time", audioMap.getPlayableClip().getPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getBatch().draw(background, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
getBatch().draw(background, 0f, 0f, Main.GAME_AREA_WIDTH, Main.GAME_AREA_HEIGHT);
|
||||||
getBatch().end();
|
getBatch().end();
|
||||||
|
|
||||||
getBatch().setShader(null);
|
getBatch().setShader(null);
|
||||||
@ -144,7 +144,7 @@ public class GamePlayArea extends Stage {
|
|||||||
getBatch().setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
getBatch().setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
getBatch().begin();
|
getBatch().begin();
|
||||||
getBatch().setShader(glowShader);
|
getBatch().setShader(glowShader);
|
||||||
getBatch().draw(fboRegion, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
getBatch().draw(fboRegion, 0f, 0f, Main.GAME_AREA_WIDTH, Main.GAME_AREA_HEIGHT);
|
||||||
getBatch().setShader(null);
|
getBatch().setShader(null);
|
||||||
getBatch().end();
|
getBatch().end();
|
||||||
|
|
||||||
@ -158,7 +158,6 @@ public class GamePlayArea extends Stage {
|
|||||||
MapWindowData mwd;
|
MapWindowData mwd;
|
||||||
if (audioMap != null && audioMap.getPlayableClip().isPlaying()) {
|
if (audioMap != null && audioMap.getPlayableClip().isPlaying()) {
|
||||||
audioMap.getMusicData().readIndexUpdate();
|
audioMap.getMusicData().readIndexUpdate();
|
||||||
time = audioMap.getPlayableClip().getPosition();
|
|
||||||
if ((mwd = audioMap.nextWindowData()) != null) {
|
if ((mwd = audioMap.nextWindowData()) != null) {
|
||||||
EntitySpawnInfo[] currentSpawnInfo = mwd.getArray();
|
EntitySpawnInfo[] currentSpawnInfo = mwd.getArray();
|
||||||
if (currentSpawnInfo != null) {
|
if (currentSpawnInfo != null) {
|
||||||
@ -177,14 +176,14 @@ public class GamePlayArea extends Stage {
|
|||||||
polyjet.setX(1f);
|
polyjet.setX(1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polyjet.getX() >= Polyjet.GAME_AREA_WIDTH-1-polyjet.getWidth()) {
|
if (polyjet.getX() >= Main.GAME_AREA_WIDTH-1-polyjet.getWidth()) {
|
||||||
polyjet.moveRight = false;
|
polyjet.moveRight = false;
|
||||||
polyjet.setX(Polyjet.GAME_AREA_WIDTH-1f-polyjet.getWidth());
|
polyjet.setX(Main.GAME_AREA_WIDTH-1f-polyjet.getWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polyjet.getY() >= Polyjet.GAME_AREA_HEIGHT - 1 - polyjet.getHeight()) {
|
if (polyjet.getY() >= Main.GAME_AREA_HEIGHT - 1 - polyjet.getHeight()) {
|
||||||
polyjet.moveUp = false;
|
polyjet.moveUp = false;
|
||||||
polyjet.setY(Polyjet.GAME_AREA_HEIGHT - 1 - polyjet.getHeight());
|
polyjet.setY(Main.GAME_AREA_HEIGHT - 1 - polyjet.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polyjet.getY() <= 1) {
|
if (polyjet.getY() <= 1) {
|
||||||
@ -260,7 +259,7 @@ public class GamePlayArea extends Stage {
|
|||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getMaxHealth() {
|
public int getMaxHealth() {
|
||||||
return maxHealth;
|
return maxHealth;
|
||||||
}
|
}
|
||||||
public float getyTeleport() {
|
public float getyTeleport() {
|
||||||
|
31
core/src/zero1hd/polyjet/ui/windows/PauseMenu.java
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
package zero1hd.polyjet.ui.windows;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
|
|
||||||
|
public class PauseMenu extends Window {
|
||||||
|
private Label label;
|
||||||
|
private TextButton resumeButton;
|
||||||
|
|
||||||
|
public PauseMenu(Skin skin) {
|
||||||
|
super("Paused", skin, "tinted");
|
||||||
|
defaults().pad(35f);
|
||||||
|
label = new Label("Game is paused.", skin);
|
||||||
|
add(label).spaceBottom(20f);
|
||||||
|
row();
|
||||||
|
|
||||||
|
resumeButton = new TextButton("Resume", skin);
|
||||||
|
add(resumeButton);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
|
||||||
|
setModal(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TextButton getResumeButton() {
|
||||||
|
return resumeButton;
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@ package zero1hd.polyjet.desktop;
|
|||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Main;
|
||||||
|
|
||||||
public class DesktopLauncher {
|
public class DesktopLauncher {
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
@ -15,7 +15,7 @@ public class DesktopLauncher {
|
|||||||
// System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
|
// System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
|
||||||
|
|
||||||
|
|
||||||
new LwjglApplication(new Polyjet(), config);
|
new LwjglApplication(new Main(), config);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|