Fixed interface details. Removed pause state.

This commit is contained in:
2014-06-06 12:43:45 -04:30
parent 4cba697f57
commit d4edcf4909
7 changed files with 325 additions and 572 deletions

View File

@@ -15,9 +15,9 @@
*/ */
package ve.ucv.ciens.ccg.nxtar; package ve.ucv.ciens.ccg.nxtar;
import ve.ucv.ciens.ccg.nxtar.interfaces.ImageProcessor;
import ve.ucv.ciens.ccg.nxtar.interfaces.ApplicationEventsListener;
import ve.ucv.ciens.ccg.nxtar.interfaces.ActionResolver; import ve.ucv.ciens.ccg.nxtar.interfaces.ActionResolver;
import ve.ucv.ciens.ccg.nxtar.interfaces.ApplicationEventsListener;
import ve.ucv.ciens.ccg.nxtar.interfaces.ImageProcessor;
import ve.ucv.ciens.ccg.nxtar.network.RobotControlThread; import ve.ucv.ciens.ccg.nxtar.network.RobotControlThread;
import ve.ucv.ciens.ccg.nxtar.network.SensorReportThread; import ve.ucv.ciens.ccg.nxtar.network.SensorReportThread;
import ve.ucv.ciens.ccg.nxtar.network.ServiceDiscoveryThread; import ve.ucv.ciens.ccg.nxtar.network.ServiceDiscoveryThread;
@@ -27,7 +27,6 @@ import ve.ucv.ciens.ccg.nxtar.states.CameraCalibrationState;
import ve.ucv.ciens.ccg.nxtar.states.InGameState; import ve.ucv.ciens.ccg.nxtar.states.InGameState;
import ve.ucv.ciens.ccg.nxtar.states.MainMenuStateBase; import ve.ucv.ciens.ccg.nxtar.states.MainMenuStateBase;
import ve.ucv.ciens.ccg.nxtar.states.OuyaMainMenuState; import ve.ucv.ciens.ccg.nxtar.states.OuyaMainMenuState;
import ve.ucv.ciens.ccg.nxtar.states.PauseState;
import ve.ucv.ciens.ccg.nxtar.states.TabletMainMenuState; import ve.ucv.ciens.ccg.nxtar.states.TabletMainMenuState;
import ve.ucv.ciens.ccg.nxtar.utils.GameSettings; import ve.ucv.ciens.ccg.nxtar.utils.GameSettings;
import ve.ucv.ciens.ccg.nxtar.utils.ProjectConstants; import ve.ucv.ciens.ccg.nxtar.utils.ProjectConstants;
@@ -74,7 +73,7 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
* Valid game states. * Valid game states.
*/ */
public enum game_states_t { public enum game_states_t {
MAIN_MENU(0), IN_GAME(1), PAUSED(2), CALIBRATION(3); MAIN_MENU(0), IN_GAME(1), CALIBRATION(2);
private int value; private int value;
@@ -239,7 +238,6 @@ public class NxtARCore extends Game implements ApplicationEventsListener{
else else
states[game_states_t.MAIN_MENU.getValue()] = new TabletMainMenuState(this); states[game_states_t.MAIN_MENU.getValue()] = new TabletMainMenuState(this);
states[game_states_t.IN_GAME.getValue()] = new InGameState(this); states[game_states_t.IN_GAME.getValue()] = new InGameState(this);
states[game_states_t.PAUSED.getValue()] = new PauseState(this);
states[game_states_t.CALIBRATION.getValue()] = new CameraCalibrationState(this); states[game_states_t.CALIBRATION.getValue()] = new CameraCalibrationState(this);
// Register controller listeners. // Register controller listeners.

View File

@@ -186,6 +186,23 @@ public class BombGameEntityCreator extends EntityCreatorBase{
entitiesCreated = true; entitiesCreated = true;
} }
@Override
public boolean updateAssetManager() throws NullPointerException{
boolean doneLoading;
if(core == null)
throw new NullPointerException("Core has not been set.");
doneLoading = manager.update();
if(doneLoading){
getModels();
createAllEntities();
core.onAssetsLoaded();
}
return doneLoading;
}
@Override @Override
public void dispose() { public void dispose() {
if(shader != null) shader.dispose(); if(shader != null) shader.dispose();
@@ -383,21 +400,4 @@ public class BombGameEntityCreator extends EntityCreatorBase{
wiresBombCollisionModelWire3 = manager.get("models/collision_models/bomb_game/cable_3_col.g3db", Model.class); wiresBombCollisionModelWire3 = manager.get("models/collision_models/bomb_game/cable_3_col.g3db", Model.class);
// easterEggCollisionModel = manager.get("models/collision_models/bomb_game/door.g3db", Model.class); // easterEggCollisionModel = manager.get("models/collision_models/bomb_game/door.g3db", Model.class);
} }
@Override
public boolean updateAssetManager(){
boolean doneLoading;
if(core == null)
throw new NullPointerException("Core has not been set.");
doneLoading = manager.update();
if(doneLoading){
getModels();
createAllEntities();
core.onAssetsLoaded();
}
return doneLoading;
}
} }

View File

@@ -26,28 +26,16 @@ import ve.ucv.ciens.ccg.nxtar.utils.Size;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input; import com.badlogic.gdx.Input;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.mappings.Ouya; import com.badlogic.gdx.controllers.mappings.Ouya;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.Texture.TextureWrap; import com.badlogic.gdx.graphics.Texture.TextureWrap;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
public class CameraCalibrationState extends BaseState{ public class CameraCalibrationState extends BaseState{
private static final String TAG = "CAMERA_CALIBRATION_STATE"; private static final String TAG = "CAMERA_CALIBRATION_STATE";
@@ -55,6 +43,7 @@ public class CameraCalibrationState extends BaseState{
private static final String SHADER_PATH = "shaders/bckg/bckg"; private static final String SHADER_PATH = "shaders/bckg/bckg";
private NxtARCore core; private NxtARCore core;
private boolean cameraCalibrated;
private float u_scaling[]; private float u_scaling[];
protected Sprite background; protected Sprite background;
@@ -69,36 +58,16 @@ public class CameraCalibrationState extends BaseState{
private Sprite renderableVideoFrame; private Sprite renderableVideoFrame;
private Pixmap videoFrame; private Pixmap videoFrame;
// Gui components.
private TextButton takeSampleButton;
private Rectangle takeSampleButtonBBox;
private Texture buttonEnabledTexture;
private Texture buttonDisabledTexture;
private Texture buttonPressedTexture;
private NinePatch buttonEnabled9p;
private NinePatch buttonDisabled9p;
private NinePatch buttonPressed9p;
private BitmapFont font;
// Button touch helper fields.
private boolean takeSampleButtonTouched;
private int takeSampleButtonPointer;
// Monitors. // Monitors.
private VideoFrameMonitor frameMonitor; private VideoFrameMonitor frameMonitor;
private float[][] calibrationSamples; private float[][] calibrationSamples;
@SuppressWarnings("unused")
private boolean takeSample;
private int lastSampleTaken; private int lastSampleTaken;
public CameraCalibrationState(final NxtARCore core){ public CameraCalibrationState(final NxtARCore core){
TextButtonStyle tbs;
FreeTypeFontGenerator generator;
FreeTypeFontParameter param;
this.core = core; this.core = core;
frameMonitor = VideoFrameMonitor.getInstance(); frameMonitor = VideoFrameMonitor.getInstance();
cameraCalibrated = false;
// Set up the cameras. // Set up the cameras.
pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
@@ -125,46 +94,6 @@ public class CameraCalibrationState extends BaseState{
u_scaling[0] = Gdx.graphics.getWidth() > Gdx.graphics.getHeight() ? 16.0f : 9.0f; u_scaling[0] = Gdx.graphics.getWidth() > Gdx.graphics.getHeight() ? 16.0f : 9.0f;
u_scaling[1] = Gdx.graphics.getHeight() > Gdx.graphics.getWidth() ? 16.0f : 9.0f; u_scaling[1] = Gdx.graphics.getHeight() > Gdx.graphics.getWidth() ? 16.0f : 9.0f;
// Set up the sampling button.
// Create the font.
param = new FreeTypeFontParameter();
param.characters = ProjectConstants.FONT_CHARS;
param.size = ProjectConstants.MENU_BUTTON_FONT_SIZE;
param.flip = false;
generator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/d-puntillas-B-to-tiptoe.ttf"));
font = generator.generateFont(param);
generator.dispose();
// Load the textures.
buttonEnabledTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Yellow.png"));
buttonEnabled9p = new NinePatch(new TextureRegion(buttonEnabledTexture, 0, 0, buttonEnabledTexture.getWidth(), buttonEnabledTexture.getHeight()), 49, 49, 45, 45);
buttonDisabledTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Cyan.png"));
buttonDisabled9p = new NinePatch(new TextureRegion(buttonDisabledTexture, 0, 0, buttonDisabledTexture.getWidth(), buttonDisabledTexture.getHeight()), 49, 49, 45, 45);
buttonPressedTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Blue.png"));
buttonPressed9p = new NinePatch(new TextureRegion(buttonPressedTexture, 0, 0, buttonPressedTexture.getWidth(), buttonPressedTexture.getHeight()), 49, 49, 45, 45);
// Create the button style.
tbs = new TextButtonStyle();
tbs.font = font;
tbs.up = new NinePatchDrawable(buttonEnabled9p);
tbs.checked = new NinePatchDrawable(buttonPressed9p);
tbs.disabled = new NinePatchDrawable(buttonDisabled9p);
tbs.disabledFontColor = new Color(0, 0, 0, 1);
// Create the button itself.
takeSampleButton = new TextButton("Take calibration sample", tbs);
takeSampleButton.setText("Take calibration sample");
takeSampleButton.setDisabled(true);
takeSampleButtonBBox = new Rectangle(0, 0, takeSampleButton.getWidth(), takeSampleButton.getHeight());
takeSampleButton.setPosition(-(takeSampleButton.getWidth() / 2), -(Gdx.graphics.getHeight()/2) - 1 + (takeSampleButton.getHeight() / 2));
takeSampleButtonBBox.setPosition(takeSampleButton.getX(), takeSampleButton.getY());
// Set up the touch collision detection variables.
win2world = new Vector3(0.0f, 0.0f, 0.0f);
touchPointWorldCoords = new Vector2();
takeSampleButtonTouched = false;
takeSampleButtonPointer = -1;
// Initialize the calibration samples vector. // Initialize the calibration samples vector.
calibrationSamples = new float[ProjectConstants.CALIBRATION_SAMPLES][]; calibrationSamples = new float[ProjectConstants.CALIBRATION_SAMPLES][];
for(int i = 0; i < calibrationSamples.length; i++){ for(int i = 0; i < calibrationSamples.length; i++){
@@ -178,8 +107,8 @@ public class CameraCalibrationState extends BaseState{
Gdx.input.setCatchBackKey(true); Gdx.input.setCatchBackKey(true);
Gdx.input.setCatchMenuKey(true); Gdx.input.setCatchMenuKey(true);
takeSample = false;
lastSampleTaken = 0; lastSampleTaken = 0;
cameraCalibrated = false;
for(int i = 0; i < calibrationSamples.length; i++){ for(int i = 0; i < calibrationSamples.length; i++){
for(int j = 0; j < calibrationSamples[i].length; j++){ for(int j = 0; j < calibrationSamples[i].length; j++){
@@ -193,7 +122,6 @@ public class CameraCalibrationState extends BaseState{
@Override @Override
public void render(float delta){ public void render(float delta){
String msg;
byte[] frame; byte[] frame;
byte[] prevFrame = null; byte[] prevFrame = null;
Size dimensions = null; Size dimensions = null;
@@ -219,17 +147,8 @@ public class CameraCalibrationState extends BaseState{
// Find the calibration points in the video frame. // Find the calibration points in the video frame.
CalibrationData data = core.cvProc.findCalibrationPattern(frame); CalibrationData data = core.cvProc.findCalibrationPattern(frame);
// Disable the sampling button if the calibration pattern was not found.
if(data.calibrationPoints != null && !core.cvProc.isCameraCalibrated()){
takeSampleButton.setDisabled(false);
}else{
takeSampleButton.setDisabled(true);
}
// If the user requested a sample be taken. // If the user requested a sample be taken.
if(/*takeSample && */!core.cvProc.isCameraCalibrated() && data.calibrationPoints != null){ if(!cameraCalibrated && data.calibrationPoints != null){
// Disable sample taking.
takeSample = false;
Gdx.app.log(TAG, CLASS_NAME + ".render(): Sample taken."); Gdx.app.log(TAG, CLASS_NAME + ".render(): Sample taken.");
// Save the calibration points to the samples array. // Save the calibration points to the samples array.
@@ -242,15 +161,12 @@ public class CameraCalibrationState extends BaseState{
// Move to the next sample. // Move to the next sample.
lastSampleTaken++; lastSampleTaken++;
msg = Integer.toString(lastSampleTaken) + " samples taken. ";
msg += Integer.toString(ProjectConstants.CALIBRATION_SAMPLES - lastSampleTaken) + " samples left.";
core.toast(msg, false);
// If enough samples has been taken then calibrate the camera. // If enough samples has been taken then calibrate the camera.
if(lastSampleTaken == ProjectConstants.CALIBRATION_SAMPLES){ if(lastSampleTaken == ProjectConstants.CALIBRATION_SAMPLES){
Gdx.app.log(TAG, CLASS_NAME + "render(): Last sample taken."); Gdx.app.log(TAG, CLASS_NAME + "render(): Last sample taken.");
core.cvProc.calibrateCamera(calibrationSamples, frame); core.cvProc.calibrateCamera(calibrationSamples, frame);
cameraCalibrated = core.cvProc.isCameraCalibrated();
core.onCameraCalibrated(); core.onCameraCalibrated();
core.nextState = game_states_t.MAIN_MENU; core.nextState = game_states_t.MAIN_MENU;
} }
@@ -281,11 +197,8 @@ public class CameraCalibrationState extends BaseState{
} }
// Render the frame. // Render the frame.
if(!Ouya.runningOnOuya){ if(!Ouya.runningOnOuya) core.batch.setProjectionMatrix(camera.combined);
core.batch.setProjectionMatrix(camera.combined); else core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
}else{
core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
}
core.batch.begin();{ core.batch.begin();{
renderableVideoFrame.draw(core.batch); renderableVideoFrame.draw(core.batch);
}core.batch.end(); }core.batch.end();
@@ -294,35 +207,10 @@ public class CameraCalibrationState extends BaseState{
videoFrameTexture.dispose(); videoFrameTexture.dispose();
} }
// Render the user interface.
/*if(!Ouya.runningOnOuya){
core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
core.batch.begin();{
takeSampleButton.draw(core.batch, 1.0f);
}core.batch.end();
}else{
// TODO: Render OUYA gui.
}*/
// Save this frame as previous to avoid processing the same frame twice when network latency is high. // Save this frame as previous to avoid processing the same frame twice when network latency is high.
prevFrame = frame; prevFrame = frame;
} }
@Override
public void resize(int width, int height){ }
@Override
public void show(){ }
@Override
public void hide(){ }
@Override
public void pause(){ }
@Override
public void resume(){ }
@Override @Override
public void dispose(){ public void dispose(){
if(videoFrameTexture != null) if(videoFrameTexture != null)
@@ -343,74 +231,4 @@ public class CameraCalibrationState extends BaseState{
} }
return false; return false;
} }
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button){
unprojectTouch(screenX, screenY);
Gdx.app.log(TAG, CLASS_NAME + String.format(".touchDown(%d, %d, %d, %d)", screenX, screenY, pointer, button));
Gdx.app.log(TAG, CLASS_NAME + String.format(".touchDown() :: Unprojected touch point: (%f, %f)", touchPointWorldCoords.x, touchPointWorldCoords.y));
if(!takeSampleButton.isDisabled() && takeSampleButtonBBox.contains(touchPointWorldCoords) && !takeSampleButtonTouched){
takeSampleButton.setChecked(true);
takeSampleButtonTouched = true;
takeSampleButtonPointer = pointer;
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Sample button pressed.");
}
return true;
}
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button){
unprojectTouch(screenX, screenY);
Gdx.app.log(TAG, CLASS_NAME + String.format(".touchUp(%d, %d, %d, %d)", screenX, screenY, pointer, button));
Gdx.app.log(TAG, CLASS_NAME + String.format(".touchUp() :: Unprojected touch point: (%f, %f)", touchPointWorldCoords.x, touchPointWorldCoords.y));
if(!takeSampleButton.isDisabled() && takeSampleButtonBBox.contains(touchPointWorldCoords) && takeSampleButtonTouched){
takeSampleButton.setChecked(false);
takeSampleButtonTouched = false;
takeSampleButtonPointer = -1;
takeSample = true;
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Sample button released.");
}
return true;
}
@Override
public boolean touchDragged(int screenX, int screenY, int pointer){
unprojectTouch(screenX, screenY);
if(!takeSampleButton.isDisabled() && takeSampleButtonTouched && pointer == takeSampleButtonPointer && !takeSampleButtonBBox.contains(touchPointWorldCoords)){
takeSampleButtonPointer = -1;
takeSampleButtonTouched = false;
takeSampleButton.setChecked(false);
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Sample button released.");
}
return true;
}
@Override
public boolean buttonDown(Controller controller, int buttonCode){
// TODO: Handle OUYA controls.
return false;
}
@Override
public boolean buttonUp(Controller controller, int buttonCode){
// TODO: Handle OUYA controls.
return false;
}
@Override
public boolean axisMoved(Controller controller, int axisCode, float value){
// TODO: Handle OUYA controls.
return false;
}
} }

View File

@@ -51,49 +51,46 @@ public abstract class MainMenuStateBase extends BaseState{
protected boolean clientConnected; protected boolean clientConnected;
protected boolean cameraCalibrated; protected boolean cameraCalibrated;
protected boolean assetsLoaded; protected boolean assetsLoaded;
private float u_scaling[]; private float u_scaling[];
// Buttons and other gui components. // Buttons and other gui components.
protected TextButton startButton; protected TextButton startButton;
protected Rectangle startButtonBBox; protected Rectangle startButtonBBox;
protected Sprite clientConnectedLedOn;
protected Sprite clientConnectedLedOff;
protected TextButton calibrationButton; protected TextButton calibrationButton;
protected Rectangle calibrationButtonBBox; protected Rectangle calibrationButtonBBox;
protected Sprite cameraCalibratedLedOn; protected Sprite cameraCalibratedLedOn;
protected Sprite cameraCalibratedLedOff; protected Sprite cameraCalibratedLedOff;
protected Sprite assetsLoadedLedOn;
protected Sprite assetsLoadedLedOff;
protected Sprite background; protected Sprite background;
// Graphic data for the start button. // Graphic data for the start button.
private Texture menuButtonEnabledTexture; private Texture menuButtonEnabledTexture;
private Texture menuButtonDisabledTexture; private Texture menuButtonDisabledTexture;
private Texture menuButtonPressedTexture; private Texture menuButtonPressedTexture;
private NinePatch menuButtonEnabled9p; private NinePatch menuButtonEnabled9p;
private NinePatch menuButtonDisabled9p; private NinePatch menuButtonDisabled9p;
private NinePatch menuButtonPressed9p; private NinePatch menuButtonPressed9p;
private BitmapFont font; private BitmapFont font;
// Other graphics. // Other graphics.
private Texture cameraCalibratedLedOffTexture; private Texture ledOffTexture;
private Texture cameraCalibratedLedOnTexture; private Texture ledOnTexture;
private Texture clientConnectedLedOffTexture; private Texture backgroundTexture;
private Texture clientConnectedLedOnTexture;
private Texture backgroundTexture;
private ShaderProgram backgroundShader; private ShaderProgram backgroundShader;
// Button touch helper fields. // Button touch helper fields.
protected boolean startButtonTouched; protected boolean startButtonTouched;
protected int startButtonTouchPointer; protected int startButtonTouchPointer;
protected boolean calibrationButtonTouched; protected boolean calibrationButtonTouched;
protected int calibrationButtonTouchPointer; protected int calibrationButtonTouchPointer;
public MainMenuStateBase(){ public MainMenuStateBase(){
TextureRegion region; TextureRegion region;
TextButtonStyle tbs; TextButtonStyle textButtonStyle;
FreeTypeFontGenerator generator; FreeTypeFontGenerator fontGenerator;
FreeTypeFontParameter param; FreeTypeFontParameter fontParameters;
this.pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
@@ -108,50 +105,49 @@ public abstract class MainMenuStateBase extends BaseState{
menuButtonPressed9p = new NinePatch(new TextureRegion(menuButtonPressedTexture, 0, 0, menuButtonPressedTexture.getWidth(), menuButtonPressedTexture.getHeight()), 49, 49, 45, 45); menuButtonPressed9p = new NinePatch(new TextureRegion(menuButtonPressedTexture, 0, 0, menuButtonPressedTexture.getWidth(), menuButtonPressedTexture.getHeight()), 49, 49, 45, 45);
// Create the start button font. // Create the start button font.
param = new FreeTypeFontParameter(); fontParameters = new FreeTypeFontParameter();
param.characters = ProjectConstants.FONT_CHARS; fontParameters.characters = ProjectConstants.FONT_CHARS;
param.size = ProjectConstants.MENU_BUTTON_FONT_SIZE; fontParameters.size = ProjectConstants.MENU_BUTTON_FONT_SIZE;
param.flip = false; fontParameters.flip = false;
generator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/d-puntillas-B-to-tiptoe.ttf")); fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/d-puntillas-B-to-tiptoe.ttf"));
font = generator.generateFont(param); font = fontGenerator.generateFont(fontParameters);
generator.dispose(); fontGenerator.dispose();
// Create the start button. // Create the start button.
tbs = new TextButtonStyle(); textButtonStyle = new TextButtonStyle();
tbs.font = font; textButtonStyle.font = font;
tbs.up = new NinePatchDrawable(menuButtonEnabled9p); textButtonStyle.up = new NinePatchDrawable(menuButtonEnabled9p);
tbs.checked = new NinePatchDrawable(menuButtonPressed9p); textButtonStyle.checked = new NinePatchDrawable(menuButtonPressed9p);
tbs.disabled = new NinePatchDrawable(menuButtonDisabled9p); textButtonStyle.disabled = new NinePatchDrawable(menuButtonDisabled9p);
tbs.disabledFontColor = new Color(0, 0, 0, 1); textButtonStyle.disabledFontColor = new Color(0, 0, 0, 1);
startButton = new TextButton("Start server", tbs); startButton = new TextButton("Start server", textButtonStyle);
startButton.setText("Start game"); startButton.setText("Start game");
startButton.setDisabled(true); startButton.setDisabled(true);
startButtonBBox = new Rectangle(0, 0, startButton.getWidth(), startButton.getHeight()); startButtonBBox = new Rectangle(0, 0, startButton.getWidth(), startButton.getHeight());
// Create the calibration button. // Create the calibration button.
calibrationButton = new TextButton("Calibrate camera", tbs); calibrationButton = new TextButton("Calibrate camera", textButtonStyle);
calibrationButton.setText("Calibrate camera"); calibrationButton.setText("Calibrate camera");
calibrationButton.setDisabled(true); calibrationButton.setDisabled(true);
calibrationButtonBBox = new Rectangle(0, 0, calibrationButton.getWidth(), calibrationButton.getHeight()); calibrationButtonBBox = new Rectangle(0, 0, calibrationButton.getWidth(), calibrationButton.getHeight());
// Create the connection leds. // Create the connection leds.
clientConnectedLedOnTexture = new Texture("data/gfx/gui/Anonymous_Button_Green.png"); ledOnTexture = new Texture("data/gfx/gui/Anonymous_Button_Green.png");
region = new TextureRegion(clientConnectedLedOnTexture); ledOffTexture = new Texture("data/gfx/gui/Anonymous_Button_Red.png");
clientConnectedLedOn = new Sprite(region);
clientConnectedLedOffTexture = new Texture("data/gfx/gui/Anonymous_Button_Red.png"); region = new TextureRegion(ledOnTexture);
region = new TextureRegion(clientConnectedLedOffTexture);
clientConnectedLedOff = new Sprite(region);
cameraCalibratedLedOnTexture = new Texture("data/gfx/gui/Anonymous_Button_Green.png");
region = new TextureRegion(cameraCalibratedLedOnTexture);
cameraCalibratedLedOn = new Sprite(region); cameraCalibratedLedOn = new Sprite(region);
cameraCalibratedLedOffTexture = new Texture("data/gfx/gui/Anonymous_Button_Red.png"); region = new TextureRegion(ledOffTexture);
region = new TextureRegion(cameraCalibratedLedOffTexture);
cameraCalibratedLedOff = new Sprite(region); cameraCalibratedLedOff = new Sprite(region);
region = new TextureRegion(ledOnTexture);
assetsLoadedLedOn = new Sprite(region);
region = new TextureRegion(ledOffTexture);
assetsLoadedLedOff = new Sprite(region);
// Set up the background. // Set up the background.
backgroundTexture = new Texture(Gdx.files.internal("data/gfx/textures/tile_aqua.png")); backgroundTexture = new Texture(Gdx.files.internal("data/gfx/textures/tile_aqua.png"));
backgroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); backgroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
@@ -188,29 +184,13 @@ public abstract class MainMenuStateBase extends BaseState{
@Override @Override
public abstract void render(float delta); public abstract void render(float delta);
@Override
public void resize(int width, int height){ }
@Override
public void show(){ }
@Override
public void hide(){ }
@Override
public void pause(){ }
@Override
public void resume(){ }
@Override @Override
public void dispose(){ public void dispose(){
menuButtonEnabledTexture.dispose(); menuButtonEnabledTexture.dispose();
menuButtonDisabledTexture.dispose(); menuButtonDisabledTexture.dispose();
menuButtonPressedTexture.dispose(); menuButtonPressedTexture.dispose();
clientConnectedLedOnTexture.dispose(); ledOnTexture.dispose();
clientConnectedLedOffTexture.dispose(); ledOffTexture.dispose();
cameraCalibratedLedOnTexture.dispose();
cameraCalibratedLedOffTexture.dispose();
backgroundTexture.dispose(); backgroundTexture.dispose();
if(backgroundShader != null) backgroundShader.dispose(); if(backgroundShader != null) backgroundShader.dispose();
font.dispose(); font.dispose();
@@ -248,7 +228,6 @@ public abstract class MainMenuStateBase extends BaseState{
public void onCameraCalibrated(){ public void onCameraCalibrated(){
cameraCalibrated = true; cameraCalibrated = true;
calibrationButton.setDisabled(true);
startGame(); startGame();
} }

View File

@@ -1,171 +1,175 @@
/* /*
* Copyright (C) 2014 Miguel Angel Astor Romero * Copyright (C) 2014 Miguel Angel Astor Romero
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package ve.ucv.ciens.ccg.nxtar.states; package ve.ucv.ciens.ccg.nxtar.states;
import ve.ucv.ciens.ccg.nxtar.NxtARCore; import ve.ucv.ciens.ccg.nxtar.NxtARCore;
import ve.ucv.ciens.ccg.nxtar.NxtARCore.game_states_t; import ve.ucv.ciens.ccg.nxtar.NxtARCore.game_states_t;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.controllers.Controller; import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.mappings.Ouya; import com.badlogic.gdx.controllers.mappings.Ouya;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
public class OuyaMainMenuState extends MainMenuStateBase{ public class OuyaMainMenuState extends MainMenuStateBase{
private static final String CLASS_NAME = OuyaMainMenuState.class.getSimpleName(); private static final String CLASS_NAME = OuyaMainMenuState.class.getSimpleName();
private Texture ouyaOButtonTexture; private Texture ouyaOButtonTexture;
private Sprite ouyaOButton; private Sprite ouyaOButton;
private boolean oButtonPressed; private boolean oButtonPressed;
private int oButtonSelection; private int oButtonSelection;
private float ledYPos;
public OuyaMainMenuState(final NxtARCore core){
super(); public OuyaMainMenuState(final NxtARCore core){
super();
this.core = core;
this.core = core;
startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2));
startButtonBBox.setPosition(startButton.getX(), startButton.getY()); // Set buttons.
startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2));
calibrationButton.setPosition(-(calibrationButton.getWidth() / 2), (startButton.getY() + startButton.getHeight()) + 10); startButtonBBox.setPosition(startButton.getX(), startButton.getY());
calibrationButtonBBox.setPosition(calibrationButton.getX(), calibrationButton.getY()); calibrationButton.setPosition(-(calibrationButton.getWidth() / 2), (startButton.getY() + startButton.getHeight()) + 10);
calibrationButtonBBox.setPosition(calibrationButton.getX(), calibrationButton.getY());
float ledYPos = (-(Gdx.graphics.getHeight() / 2) * 0.5f) + (calibrationButton.getY() * 0.5f);
clientConnectedLedOn.setSize(clientConnectedLedOn.getWidth() * 0.5f, clientConnectedLedOn.getHeight() * 0.5f); //Set leds.
clientConnectedLedOn.setPosition(-(clientConnectedLedOn.getWidth() / 2), ledYPos); ledYPos = (-(Gdx.graphics.getHeight() / 2) * 0.5f) + (calibrationButton.getY() * 0.5f);
cameraCalibratedLedOn.setSize(cameraCalibratedLedOn.getWidth() * 0.5f, cameraCalibratedLedOn.getHeight() * 0.5f);
clientConnectedLedOff.setSize(clientConnectedLedOff.getWidth() * 0.5f, clientConnectedLedOff.getHeight() * 0.5f); cameraCalibratedLedOn.setPosition(-cameraCalibratedLedOn.getWidth() - 5, ledYPos);
clientConnectedLedOff.setPosition(-(clientConnectedLedOff.getWidth() / 2), ledYPos); cameraCalibratedLedOff.setSize(cameraCalibratedLedOff.getWidth() * 0.5f, cameraCalibratedLedOff.getHeight() * 0.5f);
cameraCalibratedLedOff.setPosition(-cameraCalibratedLedOff.getWidth() - 5, ledYPos);
// TODO: Set calibration led attributes. assetsLoadedLedOn.setSize(assetsLoadedLedOn.getWidth() * 0.5f, assetsLoadedLedOn.getHeight() * 0.5f);
assetsLoadedLedOn.setPosition(5, ledYPos);
ouyaOButtonTexture = new Texture("data/gfx/gui/OUYA_O.png"); assetsLoadedLedOff.setSize(assetsLoadedLedOff.getWidth() * 0.5f, assetsLoadedLedOff.getHeight() * 0.5f);
TextureRegion region = new TextureRegion(ouyaOButtonTexture, ouyaOButtonTexture.getWidth(), ouyaOButtonTexture.getHeight()); assetsLoadedLedOff.setPosition(5, ledYPos);
ouyaOButton = new Sprite(region);
ouyaOButton.setSize(ouyaOButton.getWidth() * 0.6f, ouyaOButton.getHeight() * 0.6f); // Set OUYA's O button.
ouyaOButtonTexture = new Texture("data/gfx/gui/OUYA_O.png");
oButtonSelection = 0; TextureRegion region = new TextureRegion(ouyaOButtonTexture, ouyaOButtonTexture.getWidth(), ouyaOButtonTexture.getHeight());
oButtonPressed = false; ouyaOButton = new Sprite(region);
} ouyaOButton.setSize(ouyaOButton.getWidth() * 0.6f, ouyaOButton.getHeight() * 0.6f);
oButtonSelection = 0;
@Override oButtonPressed = false;
public void render(float delta) { }
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); @Override
public void render(float delta) {
core.batch.setProjectionMatrix(pixelPerfectCamera.combined); Gdx.gl.glClearColor(1, 1, 1, 1);
core.batch.begin();{ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
core.batch.disableBlending();
drawBackground(core.batch); core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
core.batch.enableBlending(); core.batch.begin();{
// Render background.
if(clientConnected){ core.batch.disableBlending();
clientConnectedLedOn.draw(core.batch); drawBackground(core.batch);
}else{ core.batch.enableBlending();
clientConnectedLedOff.draw(core.batch);
} // Render leds.
if(cameraCalibrated) cameraCalibratedLedOn.draw(core.batch);
// TODO: Render calibration leds. else cameraCalibratedLedOff.draw(core.batch);
if(assetsLoaded) assetsLoadedLedOn.draw(core.batch);
startButton.draw(core.batch, 1.0f); else assetsLoadedLedOff.draw(core.batch);
calibrationButton.draw(core.batch, 1.0f);
// Render buttons.
if(oButtonSelection == 0){ startButton.draw(core.batch, 1.0f);
ouyaOButton.setPosition(startButton.getX() - ouyaOButton.getWidth() - 20, startButton.getY() + (ouyaOButton.getHeight() / 2)); calibrationButton.draw(core.batch, 1.0f);
}else if(oButtonSelection == 1){
ouyaOButton.setPosition(calibrationButton.getX() - ouyaOButton.getWidth() - 20, calibrationButton.getY() + (ouyaOButton.getHeight() / 2)); // Render O button.
} if(oButtonSelection == 0){
ouyaOButton.draw(core.batch); ouyaOButton.setPosition(startButton.getX() - ouyaOButton.getWidth() - 20, startButton.getY() + (ouyaOButton.getHeight() / 2));
}else if(oButtonSelection == 1){
}core.batch.end(); ouyaOButton.setPosition(calibrationButton.getX() - ouyaOButton.getWidth() - 20, calibrationButton.getY() + (ouyaOButton.getHeight() / 2));
} }
ouyaOButton.draw(core.batch);
@Override
public void dispose(){ }core.batch.end();
super.dispose(); }
ouyaOButtonTexture.dispose();
} @Override
public void dispose(){
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; super.dispose();
; BEGIN CONTROLLER LISTENER METHODS ; ouyaOButtonTexture.dispose();
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ }
@Override /*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
public boolean buttonDown(Controller controller, int buttonCode){ ; BEGIN CONTROLLER LISTENER METHODS ;
// TODO: Test this. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
if(stateActive){ @Override
if(buttonCode == Ouya.BUTTON_O){ public boolean buttonDown(Controller controller, int buttonCode){
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button pressed."); // TODO: Test this.
if(oButtonSelection == 0){ if(stateActive){
if(!clientConnected){ if(buttonCode == Ouya.BUTTON_O){
core.toast("Can't start the game. No client is connected.", true); Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button pressed.");
}else{
oButtonPressed = true; if(oButtonSelection == 0){
startButton.setChecked(true); if(!clientConnected){
} core.toast("Can't start the game. No client is connected.", true);
}else if(oButtonSelection == 1){ }else{
if(!clientConnected){ oButtonPressed = true;
core.toast("Can't calibrate the camera. No client is connected.", true); startButton.setChecked(true);
}else{ }
oButtonPressed = true; }else if(oButtonSelection == 1){
calibrationButton.setChecked(true); if(!clientConnected){
} core.toast("Can't calibrate the camera. No client is connected.", true);
} }else{
}else if(buttonCode == Ouya.BUTTON_DPAD_UP){ oButtonPressed = true;
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad up button pressed."); calibrationButton.setChecked(true);
oButtonSelection = oButtonSelection - 1 < 0 ? NUM_MENU_BUTTONS - 1 : oButtonSelection - 1; }
}else if(buttonCode == Ouya.BUTTON_DPAD_DOWN){ }
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad down button pressed."); }else if(buttonCode == Ouya.BUTTON_DPAD_UP){
oButtonSelection = (oButtonSelection + 1) % NUM_MENU_BUTTONS; Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad up button pressed.");
} oButtonSelection = oButtonSelection - 1 < 0 ? NUM_MENU_BUTTONS - 1 : oButtonSelection - 1;
}else if(buttonCode == Ouya.BUTTON_DPAD_DOWN){
return true; Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad down button pressed.");
}else{ oButtonSelection = (oButtonSelection + 1) % NUM_MENU_BUTTONS;
return false; }
}
} return true;
}else{
@Override return false;
public boolean buttonUp(Controller controller, int buttonCode){ }
// TODO: Test this. }
if(stateActive){ @Override
if(buttonCode == Ouya.BUTTON_O){ public boolean buttonUp(Controller controller, int buttonCode){
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button released."); // TODO: Test this.
if(oButtonPressed){ if(stateActive){
oButtonPressed = false; if(buttonCode == Ouya.BUTTON_O){
Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): O button released.");
if(oButtonSelection == 0){
startButton.setChecked(false); if(oButtonPressed){
core.nextState = game_states_t.IN_GAME; oButtonPressed = false;
}else if(oButtonSelection == 1){
calibrationButton.setChecked(false); if(oButtonSelection == 0){
core.nextState = game_states_t.IN_GAME; startButton.setChecked(false);
} core.nextState = game_states_t.IN_GAME;
} }else if(oButtonSelection == 1){
} calibrationButton.setChecked(false);
core.nextState = game_states_t.IN_GAME;
return true; }
}else{ }
return false; }
}
} return true;
} }else{
return false;
}
}
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright (C) 2014 Miguel Angel Astor Romero
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ve.ucv.ciens.ccg.nxtar.states;
import ve.ucv.ciens.ccg.nxtar.NxtARCore;
public class PauseState extends BaseState {
public PauseState(final NxtARCore core){
this.core = core;
}
@Override
public void onStateSet() {
// TODO Auto-generated method stub
}
@Override
public void onStateUnset() {
// TODO Auto-generated method stub
}
@Override
public void render(float delta) {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}

View File

@@ -1,71 +1,74 @@
/* /*
* Copyright (C) 2014 Miguel Angel Astor Romero * Copyright (C) 2014 Miguel Angel Astor Romero
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package ve.ucv.ciens.ccg.nxtar.states; package ve.ucv.ciens.ccg.nxtar.states;
import ve.ucv.ciens.ccg.nxtar.NxtARCore; import ve.ucv.ciens.ccg.nxtar.NxtARCore;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
public class TabletMainMenuState extends MainMenuStateBase{ public class TabletMainMenuState extends MainMenuStateBase{
private float ledYPos;
public TabletMainMenuState(final NxtARCore core){
super(); public TabletMainMenuState(final NxtARCore core){
super();
this.core = core;
this.core = core;
startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2));
startButtonBBox.setPosition(startButton.getX(), startButton.getY()); // Set buttons.
startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2));
calibrationButton.setPosition(-(calibrationButton.getWidth() / 2), (startButton.getY() + startButton.getHeight()) + 10); startButtonBBox.setPosition(startButton.getX(), startButton.getY());
calibrationButtonBBox.setPosition(calibrationButton.getX(), calibrationButton.getY()); calibrationButton.setPosition(-(calibrationButton.getWidth() / 2), (startButton.getY() + startButton.getHeight()) + 10);
calibrationButtonBBox.setPosition(calibrationButton.getX(), calibrationButton.getY());
float ledYPos = (-(Gdx.graphics.getHeight() / 2) * 0.5f) + (calibrationButton.getY() * 0.5f);
clientConnectedLedOn.setSize(clientConnectedLedOn.getWidth() * 0.5f, clientConnectedLedOn.getHeight() * 0.5f); // Set leds.
clientConnectedLedOn.setPosition(-(clientConnectedLedOn.getWidth() / 2), ledYPos); ledYPos = (-(Gdx.graphics.getHeight() / 2) * 0.5f) + (calibrationButton.getY() * 0.5f);
cameraCalibratedLedOn.setSize(cameraCalibratedLedOn.getWidth() * 0.5f, cameraCalibratedLedOn.getHeight() * 0.5f);
clientConnectedLedOff.setSize(clientConnectedLedOff.getWidth() * 0.5f, clientConnectedLedOff.getHeight() * 0.5f); cameraCalibratedLedOn.setPosition(-cameraCalibratedLedOn.getWidth() - 5, ledYPos);
clientConnectedLedOff.setPosition(-(clientConnectedLedOff.getWidth() / 2), ledYPos); cameraCalibratedLedOff.setSize(cameraCalibratedLedOff.getWidth() * 0.5f, cameraCalibratedLedOff.getHeight() * 0.5f);
cameraCalibratedLedOff.setPosition(-cameraCalibratedLedOff.getWidth() - 5, ledYPos);
// TODO: Set calibration led attributes. assetsLoadedLedOn.setSize(assetsLoadedLedOn.getWidth() * 0.5f, assetsLoadedLedOn.getHeight() * 0.5f);
} assetsLoadedLedOn.setPosition(5, ledYPos);
assetsLoadedLedOff.setSize(assetsLoadedLedOff.getWidth() * 0.5f, assetsLoadedLedOff.getHeight() * 0.5f);
@Override assetsLoadedLedOff.setPosition(5, ledYPos);
public void render(float delta){ }
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); @Override
public void render(float delta){
core.batch.setProjectionMatrix(pixelPerfectCamera.combined); Gdx.gl.glClearColor(1, 1, 1, 1);
core.batch.begin();{ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
core.batch.disableBlending(); core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
drawBackground(core.batch); core.batch.begin();{
core.batch.enableBlending();
// Render background.
if(clientConnected){ core.batch.disableBlending();
clientConnectedLedOn.draw(core.batch); drawBackground(core.batch);
}else{ core.batch.enableBlending();
clientConnectedLedOff.draw(core.batch);
} // Render leds.
if(cameraCalibrated) cameraCalibratedLedOn.draw(core.batch);
// TODO: Render calibration led. else cameraCalibratedLedOff.draw(core.batch);
if(assetsLoaded) assetsLoadedLedOn.draw(core.batch);
startButton.draw(core.batch, 1.0f); else assetsLoadedLedOff.draw(core.batch);
calibrationButton.draw(core.batch, 1.0f);
// Render buttons.
}core.batch.end(); startButton.draw(core.batch, 1.0f);
} calibrationButton.draw(core.batch, 1.0f);
}
}core.batch.end();
}
}