Started refactoring the app to use State Pattern.
This commit is contained in:
@@ -20,63 +20,62 @@ import ve.ucv.ciens.ccg.nxtar.interfaces.NetworkConnectionListener;
|
||||
import ve.ucv.ciens.ccg.nxtar.interfaces.Toaster;
|
||||
import ve.ucv.ciens.ccg.nxtar.network.RobotControlThread;
|
||||
import ve.ucv.ciens.ccg.nxtar.network.ServiceDiscoveryThread;
|
||||
import ve.ucv.ciens.ccg.nxtar.network.VideoFrameMonitor;
|
||||
import ve.ucv.ciens.ccg.nxtar.network.VideoStreamingThread;
|
||||
import ve.ucv.ciens.ccg.nxtar.states.BaseState;
|
||||
import ve.ucv.ciens.ccg.nxtar.states.InGameState;
|
||||
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.utils.ProjectConstants;
|
||||
import ve.ucv.ciens.ccg.nxtar.utils.Size;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.ControllerListener;
|
||||
import com.badlogic.gdx.controllers.Controllers;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.controllers.mappings.Ouya;
|
||||
import com.badlogic.gdx.graphics.GL10;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class NxtARCore implements ApplicationListener, NetworkConnectionListener, InputProcessor, ControllerListener{
|
||||
public class NxtARCore extends Game implements NetworkConnectionListener{
|
||||
private static final String TAG = "NXTAR_CORE_MAIN";
|
||||
private static final String CLASS_NAME = NxtARCore.class.getSimpleName();
|
||||
|
||||
private OrthographicCamera camera;
|
||||
private OrthographicCamera pixelPerfectCamera;
|
||||
private SpriteBatch batch;
|
||||
private Texture texture;
|
||||
private Texture buttonTexture;
|
||||
private Sprite sprite;
|
||||
private Sprite motorA;
|
||||
private Sprite motorB;
|
||||
private Sprite motorC;
|
||||
private Sprite motorD;
|
||||
private Toaster toaster;
|
||||
private MulticastEnabler mcastEnabler;
|
||||
private BitmapFont font;
|
||||
private int connections;
|
||||
private float fontX;
|
||||
private float fontY;
|
||||
private Pixmap image;
|
||||
private Vector3 win2world;
|
||||
private Vector2 touchPointWorldCoords;
|
||||
private boolean[] motorButtonsTouched;
|
||||
private int[] motorButtonsPointers;
|
||||
// Game state management fields.
|
||||
public enum game_states_t {
|
||||
MAIN_MENU(0), IN_GAME(1), PAUSED(2);
|
||||
|
||||
private VideoFrameMonitor frameMonitor;
|
||||
private int value;
|
||||
|
||||
private game_states_t(int value){
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue(){
|
||||
return this.value;
|
||||
}
|
||||
};
|
||||
public game_states_t nextState;
|
||||
private game_states_t currState;
|
||||
|
||||
// Screens.
|
||||
private BaseState[] states;
|
||||
|
||||
// Assorted fields.
|
||||
public SpriteBatch batch;
|
||||
public Toaster toaster;
|
||||
|
||||
// Networking related fields.
|
||||
private int connections;
|
||||
private MulticastEnabler mcastEnabler;
|
||||
private ServiceDiscoveryThread serviceDiscoveryThread;
|
||||
private VideoStreamingThread videoThread;
|
||||
private RobotControlThread robotThread;
|
||||
|
||||
// Overlay font.
|
||||
private float fontX;
|
||||
private float fontY;
|
||||
private BitmapFont font;
|
||||
|
||||
public NxtARCore(Application concreteApp){
|
||||
super();
|
||||
connections = 0;
|
||||
@@ -84,150 +83,93 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
||||
this.toaster = (Toaster)concreteApp;
|
||||
this.mcastEnabler = (MulticastEnabler)concreteApp;
|
||||
}catch(ClassCastException cc){
|
||||
Gdx.app.debug(TAG, CLASS_NAME + ".Main() :: concreteApp does not implement any of the required interfaces.");
|
||||
Gdx.app.debug(TAG, CLASS_NAME + ".Main() :: concreteApp does not implement some of the required interfaces.");
|
||||
Gdx.app.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(){
|
||||
image = null;
|
||||
win2world = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
touchPointWorldCoords = new Vector2();
|
||||
motorButtonsTouched = new boolean[4];
|
||||
motorButtonsTouched[0] = false;
|
||||
motorButtonsTouched[1] = false;
|
||||
motorButtonsTouched[2] = false;
|
||||
motorButtonsTouched[3] = false;
|
||||
// Create the state objects.
|
||||
states = new BaseState[3];
|
||||
if(Ouya.runningOnOuya)states[0] = new OuyaMainMenuState(this);
|
||||
else states[1] = new TabletMainMenuState(this);
|
||||
states[1] = new InGameState(this);
|
||||
states[2] = new PauseState(this);
|
||||
|
||||
motorButtonsPointers = new int[4];
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsPointers[3] = -1;
|
||||
// Set up fields.
|
||||
batch = new SpriteBatch();
|
||||
|
||||
Gdx.input.setInputProcessor(this);
|
||||
Controllers.addListener(this);
|
||||
if(ProjectConstants.DEBUG){
|
||||
// Set up the overlay font.
|
||||
fontX = -((Gdx.graphics.getWidth() * ProjectConstants.OVERSCAN) / 2) + 10;
|
||||
fontY = ((Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN) / 2) - 10;
|
||||
|
||||
font = new BitmapFont();
|
||||
|
||||
font.setColor(1.0f, 1.0f, 0.0f, 1.0f);
|
||||
if(!Ouya.runningOnOuya){
|
||||
font.setScale(1.0f);
|
||||
}else{
|
||||
font.setScale(2.5f);
|
||||
}
|
||||
}
|
||||
|
||||
//Gdx.app.setLogLevel(Application.LOG_INFO);
|
||||
Gdx.app.setLogLevel(Application.LOG_NONE);
|
||||
|
||||
pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
camera = new OrthographicCamera(1.0f, Gdx.graphics.getHeight() / Gdx.graphics.getWidth());
|
||||
batch = new SpriteBatch();
|
||||
|
||||
fontX = -((Gdx.graphics.getWidth() * ProjectConstants.OVERSCAN) / 2) + 10;
|
||||
fontY = ((Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN) / 2) - 10;
|
||||
if(!Ouya.runningOnOuya) setUpButtons();
|
||||
// Start networking.
|
||||
mcastEnabler.enableMulticast();
|
||||
|
||||
Gdx.app.debug(TAG, CLASS_NAME + ".create() :: Creating network threads");
|
||||
frameMonitor = VideoFrameMonitor.getInstance();
|
||||
serviceDiscoveryThread = ServiceDiscoveryThread.getInstance();
|
||||
videoThread = VideoStreamingThread.getInstance()/*.setToaster(toaster)*/;
|
||||
//robotThread = RobotControlThread.getInstance().setToaster(toaster);
|
||||
|
||||
mcastEnabler.enableMulticast();
|
||||
|
||||
serviceDiscoveryThread.start();
|
||||
videoThread.start();
|
||||
videoThread.startStreaming();
|
||||
//robotThread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
batch.dispose();
|
||||
if(texture != null)
|
||||
texture.dispose();
|
||||
if(buttonTexture != null)
|
||||
buttonTexture.dispose();
|
||||
font.dispose();
|
||||
image.dispose();
|
||||
videoThread.finish();
|
||||
// Set the current and next states.
|
||||
currState = game_states_t.MAIN_MENU;
|
||||
nextState = null;
|
||||
this.setScreen(states[currState.getValue()]);
|
||||
|
||||
// Set initial input handlers.
|
||||
Gdx.input.setInputProcessor(states[currState.getValue()]);
|
||||
Controllers.addListener(states[currState.getValue()]);
|
||||
|
||||
// Anything else.
|
||||
Gdx.app.setLogLevel(Application.LOG_INFO);
|
||||
// Gdx.app.setLogLevel(Application.LOG_NONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(){
|
||||
Pixmap temp;
|
||||
byte[] frame;
|
||||
Size dimensions = null;
|
||||
super.render();
|
||||
|
||||
Gdx.gl.glClearColor(1, 1, 1, 1);
|
||||
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
|
||||
// If the current state set a value for nextState then switch to that state.
|
||||
if(nextState != null){
|
||||
// Change the input processors.
|
||||
Gdx.input.setInputProcessor(states[nextState.getValue()]);
|
||||
Controllers.removeListener(states[currState.getValue()]);
|
||||
Controllers.addListener(states[nextState.getValue()]);
|
||||
|
||||
frame = frameMonitor.getCurrentFrame();
|
||||
if(frame != null){
|
||||
dimensions = frameMonitor.getFrameDimensions();
|
||||
temp = new Pixmap(frame, 0, dimensions.getWidth() * dimensions.getHeight());
|
||||
if(image == null){
|
||||
try{
|
||||
image = new Pixmap(getOptimalTextureSize(dimensions.getWidth()), getOptimalTextureSize(dimensions.getHeight()), temp.getFormat());
|
||||
}catch(ImageTooBigException e){
|
||||
toaster.showLongToast("Cannot display received frame.\n" + e.getMessage());
|
||||
Gdx.app.exit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
image.drawPixmap(temp, 0, 0);
|
||||
temp.dispose();
|
||||
texture = new Texture(image);
|
||||
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
|
||||
TextureRegion region = new TextureRegion(texture, 0, 0, dimensions.getWidth(), dimensions.getHeight());
|
||||
|
||||
sprite = new Sprite(region);
|
||||
sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);
|
||||
if(!Ouya.runningOnOuya){
|
||||
sprite.setSize(1.0f, sprite.getHeight() / sprite.getWidth() );
|
||||
sprite.rotate90(true);
|
||||
sprite.translate(-sprite.getWidth() / 2, 0.5f - sprite.getHeight());
|
||||
}else{
|
||||
float xSize = Gdx.graphics.getHeight() * (dimensions.getWidth() / dimensions.getHeight());
|
||||
sprite.setSize(xSize * ProjectConstants.OVERSCAN, Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN);
|
||||
sprite.rotate90(true);
|
||||
sprite.translate(-sprite.getWidth() / 2, -sprite.getHeight() / 2);
|
||||
// Swap the pointers and set the new screen.
|
||||
currState = nextState;
|
||||
nextState = null;
|
||||
setScreen(states[currState.getValue()]);
|
||||
}
|
||||
|
||||
if(!Ouya.runningOnOuya){
|
||||
batch.setProjectionMatrix(camera.combined);
|
||||
}else{
|
||||
batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||
}
|
||||
if(ProjectConstants.DEBUG){
|
||||
// Draw the FPS overlay.
|
||||
batch.begin();{
|
||||
sprite.draw(batch);
|
||||
}batch.end();
|
||||
|
||||
texture.dispose();
|
||||
}
|
||||
|
||||
batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||
batch.begin();{
|
||||
if(!Ouya.runningOnOuya){
|
||||
motorA.draw(batch);
|
||||
motorB.draw(batch);
|
||||
motorC.draw(batch);
|
||||
motorD.draw(batch);
|
||||
}
|
||||
font.draw(batch, String.format("Render FPS: %d", Gdx.graphics.getFramesPerSecond()), fontX, fontY);
|
||||
font.draw(batch, String.format("Network FPS: %d", videoThread.getFps()), fontX, fontY - font.getCapHeight() - 5);
|
||||
font.draw(batch, String.format("Lost Network FPS: %d", videoThread.getLostFrames()), fontX, fontY - (2 * font.getCapHeight()) - 10);
|
||||
if(dimensions != null)
|
||||
font.draw(batch, String.format("Frame size: (%d, %d)", dimensions.getWidth(), dimensions.getHeight()), fontX, fontY - (3 * font.getCapHeight()) - 15);
|
||||
font.draw(batch, String.format("Total stream FPS: %d", videoThread.getFps()), fontX, fontY - font.getCapHeight() - 5);
|
||||
font.draw(batch, String.format("Lost stream FPS: %d", videoThread.getLostFrames()), fontX, fontY - (2 * font.getCapHeight()) - 10);
|
||||
}batch.end();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height){
|
||||
}
|
||||
public void resize(int width, int height){ }
|
||||
|
||||
@Override
|
||||
public void pause(){
|
||||
@@ -241,6 +183,23 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
||||
videoThread.play();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
// Finish network threads.
|
||||
videoThread.finish();
|
||||
|
||||
// Dispose graphic objects.
|
||||
batch.dispose();
|
||||
if(ProjectConstants.DEBUG){
|
||||
font.dispose();
|
||||
}
|
||||
|
||||
// Dispose screens.
|
||||
for(int i = 0; i < states.length; i++){
|
||||
states[i].dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void networkStreamConnected(String streamName){
|
||||
if(streamName.compareTo(VideoStreamingThread.THREAD_NAME) == 0 || streamName.compareTo(RobotControlThread.THREAD_NAME) == 0)
|
||||
@@ -251,238 +210,4 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
||||
mcastEnabler.disableMulticast();
|
||||
}
|
||||
}
|
||||
|
||||
private int getOptimalTextureSize(int imageSideLength) throws ImageTooBigException{
|
||||
for(int po2: ProjectConstants.POWERS_OF_2){
|
||||
if(imageSideLength < po2) return po2;
|
||||
}
|
||||
throw new ImageTooBigException("No valid texture size found. Image too large.");
|
||||
}
|
||||
|
||||
private void setUpButtons(){
|
||||
buttonTexture = new Texture(Gdx.files.internal("data/gfx/gui/PBCrichton_Flat_Button.png"));
|
||||
buttonTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
|
||||
TextureRegion region = new TextureRegion(buttonTexture, 0, 0, buttonTexture.getWidth(), buttonTexture.getHeight());
|
||||
|
||||
motorA = new Sprite(region);
|
||||
motorA.setSize(motorA.getWidth() * 0.7f, motorA.getHeight() * 0.7f);
|
||||
|
||||
motorB = new Sprite(region);
|
||||
motorB.setSize(motorB.getWidth() * 0.7f, motorB.getHeight() * 0.7f);
|
||||
|
||||
motorC = new Sprite(region);
|
||||
motorC.setSize(motorC.getWidth() * 0.7f, motorC.getHeight() * 0.7f);
|
||||
|
||||
motorD = new Sprite(region);
|
||||
motorD.setSize(motorD.getWidth() * 0.7f, motorD.getHeight() * 0.7f);
|
||||
|
||||
motorA.setPosition(-(Gdx.graphics.getWidth() / 2) + 10, -(Gdx.graphics.getHeight() / 2) + motorB.getHeight() + 20);
|
||||
motorB.setPosition(-(Gdx.graphics.getWidth() / 2) + 20 + (motorA.getWidth() / 2), -(Gdx.graphics.getHeight() / 2) + 10);
|
||||
motorC.setPosition((Gdx.graphics.getWidth() / 2) - (1.5f * (motorD.getWidth())) - 20, -(Gdx.graphics.getHeight() / 2) + 10);
|
||||
motorD.setPosition((Gdx.graphics.getWidth() / 2) - motorD.getWidth() - 10, -(Gdx.graphics.getHeight() / 2) + 20 + motorC.getHeight());
|
||||
}
|
||||
|
||||
private class ImageTooBigException extends Exception{
|
||||
private static final long serialVersionUID = 9989L;
|
||||
|
||||
public ImageTooBigException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
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(motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor A button pressed");
|
||||
motorButtonsTouched[0] = true;
|
||||
motorButtonsPointers[0] = pointer;
|
||||
}else if(motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor B button pressed");
|
||||
motorButtonsTouched[1] = true;
|
||||
motorButtonsPointers[1] = pointer;
|
||||
}else if(motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor C button pressed");
|
||||
motorButtonsTouched[2] = true;
|
||||
motorButtonsPointers[2] = pointer;
|
||||
}else if(motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor D button pressed");
|
||||
motorButtonsTouched[3] = true;
|
||||
motorButtonsPointers[3] = pointer;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
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(motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor A button released");
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsTouched[0] = false;
|
||||
}else if(motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor B button released");
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsTouched[1] = false;
|
||||
}else if(motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor C button released");
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsTouched[2] = false;
|
||||
}else if(motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor D button released");
|
||||
motorButtonsPointers[3] = -1;
|
||||
motorButtonsTouched[3] = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
if(pointer == motorButtonsPointers[0] && !motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor A button released");
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsTouched[0] = false;
|
||||
}else if(pointer == motorButtonsPointers[1] && !motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor B button released");
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsTouched[1] = false;
|
||||
}else if(pointer == motorButtonsPointers[2] && !motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor C button released");
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsTouched[2] = false;
|
||||
}else if(pointer == motorButtonsPointers[3] && !motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor D button released");
|
||||
motorButtonsPointers[3] = -1;
|
||||
motorButtonsTouched[3] = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
Gdx.app.error(TAG, "MOUSE MOVED!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller controller, int buttonCode) {
|
||||
if(buttonCode == Ouya.BUTTON_L1){
|
||||
// Start right motor.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_L2){
|
||||
// Start left motor.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_DPAD_LEFT){
|
||||
// Look left.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_DPAD_RIGHT){
|
||||
// Look right;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisCode, float value) {
|
||||
if(axisCode == Ouya.AXIS_LEFT_TRIGGER){
|
||||
|
||||
}
|
||||
if(axisCode == Ouya.AXIS_RIGHT_TRIGGER){
|
||||
// Start
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean povMoved(Controller controller, int povCode,
|
||||
PovDirection value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean xSliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ySliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accelerometerMoved(Controller controller,
|
||||
int accelerometerCode, Vector3 value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Miguel Angel Astor Romero
|
||||
* 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.
|
||||
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ve.ucv.ciens.ccg.nxtar.states;
|
||||
package ve.ucv.ciens.ccg.nxtar.exceptions;
|
||||
|
||||
public interface NxtARState{
|
||||
public void input();
|
||||
public void update();
|
||||
public void render();
|
||||
public void pause();
|
||||
public void resume();
|
||||
public void dispose();
|
||||
public class ImageTooBigException extends Exception{
|
||||
private static final long serialVersionUID = 9989L;
|
||||
|
||||
public ImageTooBigException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
83
src/ve/ucv/ciens/ccg/nxtar/states/BaseState.java
Normal file
83
src/ve/ucv/ciens/ccg/nxtar/states/BaseState.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.ControllerListener;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public abstract class BaseState implements Screen, ControllerListener, InputProcessor {
|
||||
protected NxtARCore core;
|
||||
|
||||
/* SCREEN METHODS*/
|
||||
@Override
|
||||
public abstract void render(float delta);
|
||||
@Override
|
||||
public abstract void resize(int width, int height);
|
||||
@Override
|
||||
public abstract void show();
|
||||
@Override
|
||||
public abstract void hide();
|
||||
@Override
|
||||
public abstract void pause();
|
||||
@Override
|
||||
public abstract void resume();
|
||||
@Override
|
||||
public abstract void dispose();
|
||||
|
||||
/* INPUT PROCESSOR METHODS. */
|
||||
@Override
|
||||
public abstract boolean keyDown(int keycode);
|
||||
@Override
|
||||
public abstract boolean keyUp(int keycode);
|
||||
@Override
|
||||
public abstract boolean keyTyped(char character);
|
||||
@Override
|
||||
public abstract boolean touchDown(int screenX, int screenY, int pointer, int button);
|
||||
@Override
|
||||
public abstract boolean touchUp(int screenX, int screenY, int pointer, int button);
|
||||
@Override
|
||||
public abstract boolean touchDragged(int screenX, int screenY, int pointer);
|
||||
@Override
|
||||
public abstract boolean mouseMoved(int screenX, int screenY);
|
||||
@Override
|
||||
public abstract boolean scrolled(int amount);
|
||||
|
||||
/* CONTROLLER LISTENER METHODS. */
|
||||
@Override
|
||||
public abstract void connected(Controller controller);
|
||||
@Override
|
||||
public abstract void disconnected(Controller controller);
|
||||
@Override
|
||||
public abstract boolean buttonDown(Controller controller, int buttonCode);
|
||||
@Override
|
||||
public abstract boolean buttonUp(Controller controller, int buttonCode);
|
||||
@Override
|
||||
public abstract boolean axisMoved(Controller controller, int axisCode, float value);
|
||||
@Override
|
||||
public abstract boolean povMoved(Controller controller, int povCode, PovDirection value);
|
||||
@Override
|
||||
public abstract boolean xSliderMoved(Controller controller, int sliderCode, boolean value);
|
||||
@Override
|
||||
public abstract boolean ySliderMoved(Controller controller, int sliderCode, boolean value);
|
||||
@Override
|
||||
public abstract boolean accelerometerMoved(Controller controller, int accelerometerCode, Vector3 value);
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Miguel Angel Astor Romero
|
||||
* 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.
|
||||
@@ -15,22 +15,164 @@
|
||||
*/
|
||||
package ve.ucv.ciens.ccg.nxtar.states;
|
||||
|
||||
public class InGameState implements NxtARState{
|
||||
import ve.ucv.ciens.ccg.nxtar.NxtARCore;
|
||||
import ve.ucv.ciens.ccg.nxtar.exceptions.ImageTooBigException;
|
||||
import ve.ucv.ciens.ccg.nxtar.network.VideoFrameMonitor;
|
||||
import ve.ucv.ciens.ccg.nxtar.utils.ProjectConstants;
|
||||
import ve.ucv.ciens.ccg.nxtar.utils.Size;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.controllers.mappings.Ouya;
|
||||
import com.badlogic.gdx.graphics.GL10;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class InGameState extends BaseState{
|
||||
private static final String TAG = "IN_GAME_STATE";
|
||||
private static final String CLASS_NAME = InGameState.class.getSimpleName();
|
||||
|
||||
private NxtARCore core;
|
||||
|
||||
// Cameras.
|
||||
private OrthographicCamera camera;
|
||||
private OrthographicCamera pixelPerfectCamera;
|
||||
|
||||
// Video stream graphics.
|
||||
private Texture videoFrameTexture;
|
||||
private Sprite renderableVideoFrame;
|
||||
private Pixmap videoFrame;
|
||||
|
||||
// Interface buttons.
|
||||
private Texture buttonTexture;
|
||||
private Sprite motorA;
|
||||
private Sprite motorB;
|
||||
private Sprite motorC;
|
||||
private Sprite motorD;
|
||||
|
||||
// Button touch helper fields.
|
||||
private Vector3 win2world;
|
||||
private Vector2 touchPointWorldCoords;
|
||||
private boolean[] motorButtonsTouched;
|
||||
private int[] motorButtonsPointers;
|
||||
|
||||
private VideoFrameMonitor frameMonitor;
|
||||
|
||||
public InGameState(final NxtARCore core){
|
||||
if(!Ouya.runningOnOuya) setUpButtons();
|
||||
|
||||
this.core = core;
|
||||
frameMonitor = VideoFrameMonitor.getInstance();
|
||||
|
||||
// Set up rendering fields;
|
||||
videoFrame = null;
|
||||
|
||||
// Set up the cameras.
|
||||
pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
camera = new OrthographicCamera(1.0f, Gdx.graphics.getHeight() / Gdx.graphics.getWidth());
|
||||
|
||||
// Set up input handling support fields.
|
||||
win2world = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
touchPointWorldCoords = new Vector2();
|
||||
motorButtonsTouched = new boolean[4];
|
||||
motorButtonsTouched[0] = false;
|
||||
motorButtonsTouched[1] = false;
|
||||
motorButtonsTouched[2] = false;
|
||||
motorButtonsTouched[3] = false;
|
||||
|
||||
motorButtonsPointers = new int[4];
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsPointers[3] = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void input() {
|
||||
public void render(float delta) {
|
||||
Pixmap temp;
|
||||
byte[] frame;
|
||||
Size dimensions = null;
|
||||
|
||||
Gdx.gl.glClearColor(1, 1, 1, 1);
|
||||
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
frame = frameMonitor.getCurrentFrame();
|
||||
if(frame != null){
|
||||
dimensions = frameMonitor.getFrameDimensions();
|
||||
temp = new Pixmap(frame, 0, dimensions.getWidth() * dimensions.getHeight());
|
||||
if(videoFrame == null){
|
||||
try{
|
||||
videoFrame = new Pixmap(getOptimalTextureSize(dimensions.getWidth()), getOptimalTextureSize(dimensions.getHeight()), temp.getFormat());
|
||||
}catch(ImageTooBigException e){
|
||||
core.toaster.showLongToast("Cannot display received frame.\n" + e.getMessage());
|
||||
Gdx.app.exit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
videoFrame.drawPixmap(temp, 0, 0);
|
||||
temp.dispose();
|
||||
videoFrameTexture = new Texture(videoFrame);
|
||||
videoFrameTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
|
||||
TextureRegion region = new TextureRegion(videoFrameTexture, 0, 0, dimensions.getWidth(), dimensions.getHeight());
|
||||
|
||||
renderableVideoFrame = new Sprite(region);
|
||||
renderableVideoFrame.setOrigin(renderableVideoFrame.getWidth() / 2, renderableVideoFrame.getHeight() / 2);
|
||||
if(!Ouya.runningOnOuya){
|
||||
renderableVideoFrame.setSize(1.0f, renderableVideoFrame.getHeight() / renderableVideoFrame.getWidth() );
|
||||
renderableVideoFrame.rotate90(true);
|
||||
renderableVideoFrame.translate(-renderableVideoFrame.getWidth() / 2, 0.5f - renderableVideoFrame.getHeight());
|
||||
}else{
|
||||
float xSize = Gdx.graphics.getHeight() * (dimensions.getWidth() / dimensions.getHeight());
|
||||
renderableVideoFrame.setSize(xSize * ProjectConstants.OVERSCAN, Gdx.graphics.getHeight() * ProjectConstants.OVERSCAN);
|
||||
renderableVideoFrame.rotate90(true);
|
||||
renderableVideoFrame.translate(-renderableVideoFrame.getWidth() / 2, -renderableVideoFrame.getHeight() / 2);
|
||||
}
|
||||
|
||||
if(!Ouya.runningOnOuya){
|
||||
core.batch.setProjectionMatrix(camera.combined);
|
||||
}else{
|
||||
core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||
}
|
||||
core.batch.begin();{
|
||||
renderableVideoFrame.draw(core.batch);
|
||||
}core.batch.end();
|
||||
|
||||
videoFrameTexture.dispose();
|
||||
}
|
||||
|
||||
core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||
core.batch.begin();{
|
||||
if(!Ouya.runningOnOuya){
|
||||
motorA.draw(core.batch);
|
||||
motorB.draw(core.batch);
|
||||
motorC.draw(core.batch);
|
||||
motorD.draw(core.batch);
|
||||
}
|
||||
}core.batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
public void show() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
public void hide() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@@ -49,8 +191,249 @@ public class InGameState implements NxtARState{
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if(videoFrameTexture != null)
|
||||
videoFrameTexture.dispose();
|
||||
if(buttonTexture != null)
|
||||
buttonTexture.dispose();
|
||||
if(videoFrame != null)
|
||||
videoFrame.dispose();
|
||||
}
|
||||
|
||||
private int getOptimalTextureSize(int imageSideLength) throws ImageTooBigException{
|
||||
for(int po2: ProjectConstants.POWERS_OF_2){
|
||||
if(imageSideLength < po2) return po2;
|
||||
}
|
||||
throw new ImageTooBigException("No valid texture size found. Image too large.");
|
||||
}
|
||||
|
||||
private void setUpButtons(){
|
||||
buttonTexture = new Texture(Gdx.files.internal("data/gfx/gui/PBCrichton_Flat_Button.png"));
|
||||
buttonTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
|
||||
TextureRegion region = new TextureRegion(buttonTexture, 0, 0, buttonTexture.getWidth(), buttonTexture.getHeight());
|
||||
|
||||
motorA = new Sprite(region);
|
||||
motorA.setSize(motorA.getWidth() * 0.7f, motorA.getHeight() * 0.7f);
|
||||
|
||||
motorB = new Sprite(region);
|
||||
motorB.setSize(motorB.getWidth() * 0.7f, motorB.getHeight() * 0.7f);
|
||||
|
||||
motorC = new Sprite(region);
|
||||
motorC.setSize(motorC.getWidth() * 0.7f, motorC.getHeight() * 0.7f);
|
||||
|
||||
motorD = new Sprite(region);
|
||||
motorD.setSize(motorD.getWidth() * 0.7f, motorD.getHeight() * 0.7f);
|
||||
|
||||
motorA.setPosition(-(Gdx.graphics.getWidth() / 2) + 10, -(Gdx.graphics.getHeight() / 2) + motorB.getHeight() + 20);
|
||||
motorB.setPosition(-(Gdx.graphics.getWidth() / 2) + 20 + (motorA.getWidth() / 2), -(Gdx.graphics.getHeight() / 2) + 10);
|
||||
motorC.setPosition((Gdx.graphics.getWidth() / 2) - (1.5f * (motorD.getWidth())) - 20, -(Gdx.graphics.getHeight() / 2) + 10);
|
||||
motorD.setPosition((Gdx.graphics.getWidth() / 2) - motorD.getWidth() - 10, -(Gdx.graphics.getHeight() / 2) + 20 + motorC.getHeight());
|
||||
}
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
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(motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor A button pressed");
|
||||
motorButtonsTouched[0] = true;
|
||||
motorButtonsPointers[0] = pointer;
|
||||
}else if(motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor B button pressed");
|
||||
motorButtonsTouched[1] = true;
|
||||
motorButtonsPointers[1] = pointer;
|
||||
}else if(motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor C button pressed");
|
||||
motorButtonsTouched[2] = true;
|
||||
motorButtonsPointers[2] = pointer;
|
||||
}else if(motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDown() :: Motor D button pressed");
|
||||
motorButtonsTouched[3] = true;
|
||||
motorButtonsPointers[3] = pointer;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
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(motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor A button released");
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsTouched[0] = false;
|
||||
}else if(motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor B button released");
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsTouched[1] = false;
|
||||
}else if(motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor C button released");
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsTouched[2] = false;
|
||||
}else if(motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchUp() :: Motor D button released");
|
||||
motorButtonsPointers[3] = -1;
|
||||
motorButtonsTouched[3] = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
if(!Ouya.runningOnOuya){
|
||||
win2world.set(screenX, screenY, 0.0f);
|
||||
camera.unproject(win2world);
|
||||
touchPointWorldCoords.set(win2world.x * Gdx.graphics.getWidth(), win2world.y * Gdx.graphics.getHeight());
|
||||
|
||||
if(pointer == motorButtonsPointers[0] && !motorA.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor A button released");
|
||||
motorButtonsPointers[0] = -1;
|
||||
motorButtonsTouched[0] = false;
|
||||
}else if(pointer == motorButtonsPointers[1] && !motorB.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor B button released");
|
||||
motorButtonsPointers[1] = -1;
|
||||
motorButtonsTouched[1] = false;
|
||||
}else if(pointer == motorButtonsPointers[2] && !motorC.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor C button released");
|
||||
motorButtonsPointers[2] = -1;
|
||||
motorButtonsTouched[2] = false;
|
||||
}else if(pointer == motorButtonsPointers[3] && !motorD.getBoundingRectangle().contains(touchPointWorldCoords)){
|
||||
Gdx.app.log(TAG, CLASS_NAME + ".touchDragged() :: Motor D button released");
|
||||
motorButtonsPointers[3] = -1;
|
||||
motorButtonsTouched[3] = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller controller, int buttonCode) {
|
||||
if(buttonCode == Ouya.BUTTON_L1){
|
||||
// Start right motor.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_L2){
|
||||
// Start left motor.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_DPAD_LEFT){
|
||||
// Look left.
|
||||
}
|
||||
if(buttonCode == Ouya.BUTTON_DPAD_RIGHT){
|
||||
// Look right;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisCode, float value) {
|
||||
if(axisCode == Ouya.AXIS_LEFT_TRIGGER){
|
||||
|
||||
}
|
||||
if(axisCode == Ouya.AXIS_RIGHT_TRIGGER){
|
||||
// Start
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean povMoved(Controller controller, int povCode,
|
||||
PovDirection value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean xSliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ySliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accelerometerMoved(Controller controller,
|
||||
int accelerometerCode, Vector3 value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Miguel Angel Astor Romero
|
||||
* 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.
|
||||
@@ -15,31 +15,45 @@
|
||||
*/
|
||||
package ve.ucv.ciens.ccg.nxtar.states;
|
||||
|
||||
/**
|
||||
* Empty state.
|
||||
*
|
||||
* Completely empty state for debugging purposes.
|
||||
*
|
||||
* @author miky
|
||||
*/
|
||||
public class DummyState implements NxtARState{
|
||||
|
||||
public abstract class MainMenuStateBase extends BaseState{
|
||||
@Override
|
||||
public abstract void render(float delta);
|
||||
|
||||
@Override
|
||||
public void input(){ }
|
||||
|
||||
@Override
|
||||
public void update(){ }
|
||||
|
||||
@Override
|
||||
public void render(){ }
|
||||
|
||||
@Override
|
||||
public void pause(){ }
|
||||
|
||||
@Override
|
||||
public void resume(){ }
|
||||
|
||||
@Override
|
||||
public void dispose(){ }
|
||||
public void resize(int width, int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
154
src/ve/ucv/ciens/ccg/nxtar/states/OuyaMainMenuState.java
Normal file
154
src/ve/ucv/ciens/ccg/nxtar/states/OuyaMainMenuState.java
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class OuyaMainMenuState extends MainMenuStateBase{
|
||||
|
||||
public OuyaMainMenuState(final NxtARCore core){
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisCode, float value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean povMoved(Controller controller, int povCode,
|
||||
PovDirection value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean xSliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ySliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accelerometerMoved(Controller controller,
|
||||
int accelerometerCode, Vector3 value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
}
|
190
src/ve/ucv/ciens/ccg/nxtar/states/PauseState.java
Normal file
190
src/ve/ucv/ciens/ccg/nxtar/states/PauseState.java
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class PauseState extends BaseState {
|
||||
|
||||
public PauseState(final NxtARCore core){
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisCode, float value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean povMoved(Controller controller, int povCode,
|
||||
PovDirection value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean xSliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ySliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accelerometerMoved(Controller controller,
|
||||
int accelerometerCode, Vector3 value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
}
|
154
src/ve/ucv/ciens/ccg/nxtar/states/TabletMainMenuState.java
Normal file
154
src/ve/ucv/ciens/ccg/nxtar/states/TabletMainMenuState.java
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.badlogic.gdx.controllers.Controller;
|
||||
import com.badlogic.gdx.controllers.PovDirection;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
|
||||
public class TabletMainMenuState extends MainMenuStateBase{
|
||||
|
||||
public TabletMainMenuState(final NxtARCore core){
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END INPUT PROCESSOR METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BEGIN CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(Controller controller) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller controller, int buttonCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisCode, float value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean povMoved(Controller controller, int povCode,
|
||||
PovDirection value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean xSliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ySliderMoved(Controller controller, int sliderCode,
|
||||
boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accelerometerMoved(Controller controller,
|
||||
int accelerometerCode, Vector3 value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; END CONTROLLER LISTENER METHODS ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||
}
|
Reference in New Issue
Block a user