Java 类com.badlogic.gdx.Input.Orientation 实例源码

项目:HAW-SE2-projecthorse    文件:NavBar.java   
/**
 * Konstruktor.
 */
public NavBar() {
    if (GameManagerFactory.getInstance().getPlatform().getOrientation() == Orientation.Landscape) {
        NAVBAR_HIGH = (int) (this.height * 0.25);
        NAVBAR_WITH = (int) (this.width);
    } else {
        NAVBAR_HIGH = (int) (this.height * 0.14);
        NAVBAR_WITH = (int) (this.width);
    }

    horizontalGroup = new HorizontalGroup();

    horizontalGroup.reverse();
    horizontalGroup.space((float) (this.width * 0.005));
    horizontalGroup.setHeight(NAVBAR_HIGH);
    horizontalGroup.setWidth(NAVBAR_WITH);
    setToTop();
    this.addActor(horizontalGroup);
    this.pack();
}
项目:gdx.automation    文件:JsonInputRecordReader.java   
@Override
public SyncProperty next() {
    JsonValue val = it.next();
    String clazz = val.getString("class");
    SyncProperty result = null;
    if (clazz.equals("Accelerometer")) {
        result = new SyncProperty.Accelerometer();
    } else if (clazz.equals("KeyPressed")) {
        result = new SyncProperty.KeyPressed();
    } else if (clazz.equals("PointerEvent")) {
        result = new SyncProperty.PointerEvent();
    } else if (clazz.equals("KeyEvent")) {
        result = new SyncProperty.KeyEvent();
    } else if (clazz.equals("Orientation")) {
        result = new SyncProperty.Orientation();
    } else if (clazz.equals("Pointer")) {
        result = new SyncProperty.Pointer();
    } else if (clazz.equals("Button")) {
        result = new SyncProperty.Button();
    }
    builder.build(result, val);
    return result;
}
项目:noiz2-gdx    文件:BackgroundSprite.java   
/**
 * Scroll the background across the frame duration.
 * 
 */
@Override
public void draw(Batch batch, float parentAlpha)
{
    scrollTimer += Gdx.graphics.getDeltaTime();

    float scaled = direction * frameDurationFactor * scrollTimer;

    if (scrollTimer > frameDuration)
    {
        scrollTimer = 0.0f;
    }

    if (orientation == Orientation.Landscape)
    {
        setU(scaled);
        setU2(scaled + 1);
    }
    else
    {
        setV(scaled);
        setV2(scaled + 1);
    }

    super.draw(batch);
}
项目:ingress-indonesia-dev    文件:AndroidInput$SensorListener.java   
public void onSensorChanged(SensorEvent paramSensorEvent)
{
  if (paramSensorEvent.sensor.getType() == 1)
  {
    if (this.nativeOrientation != Input.Orientation.Portrait)
      break label69;
    System.arraycopy(paramSensorEvent.values, 0, this.accelerometerValues, 0, this.accelerometerValues.length);
  }
  while (true)
  {
    if (paramSensorEvent.sensor.getType() == 2)
      System.arraycopy(paramSensorEvent.values, 0, this.magneticFieldValues, 0, this.magneticFieldValues.length);
    return;
    label69: this.accelerometerValues[0] = paramSensorEvent.values[1];
    this.accelerometerValues[1] = (-paramSensorEvent.values[0]);
    this.accelerometerValues[2] = paramSensorEvent.values[2];
  }
}
项目:HAW-SE2-projecthorse    文件:AndroidPlatform.java   
@Override
public void setOrientation(Orientation orientation) {
    active = orientation;
    if (orientation == Orientation.Landscape) {
        DisplayMode[] DisplayModes = Gdx.graphics.getDisplayModes();
        Gdx.graphics.setDisplayMode(DisplayModes[0].height, DisplayModes[0].width, false);
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }else{
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

}
项目:HAW-SE2-projecthorse    文件:DesktopLauncher.java   
@Override
public void setOrientation(Orientation orientation) {
    active=orientation;
    if(orientation == Orientation.Landscape)
        app.getGraphics().setDisplayMode(640, 360, false);
    else
        app.getGraphics().setDisplayMode(360,640, false);

}
项目:HAW-SE2-projecthorse    文件:Game.java   
/**
 * Über diesen Konstruktor kann eine {@link Orientation} übergeben werden.
 * 
 * @param orientation
 *            {@link Orientation}
 */
public Game(final Orientation orientation) {
    super(orientation);
    GameNavBar nav = new GameNavBar();
    this.overlay.setNavigationBar(nav);
    chest = new Chest(overlay);
}
项目:HAW-SE2-projecthorse    文件:Level.java   
/**
 * Mittels diesem Konsturcktor kann eine {@link Orientation} übergeben
 * werden.
 * 
 * @param orientation
 *            orientation
 */
public Level(final Orientation orientation) {
    GameManagerFactory.getInstance().getPlatform().setOrientation(orientation);
    height = GameManagerFactory.getInstance().getSettings().getVirtualScreenHeight();
    width = GameManagerFactory.getInstance().getSettings().getVirtualScreenWidth();

    createViewport();
    audioManager = AudioManagerImpl.getInstance();
    AssetManager.loadSounds("ui");
}
项目:HAW-SE2-projecthorse    文件:Popup.java   
/**
 * Konstruktor.
 */
public Popup() {

    if (GameManagerFactory.getInstance().getPlatform().getOrientation() == Orientation.Landscape) {
        popupHeight = 0;
        popupWidth = width / 2;
        content.setHeight(popupHeight);
        content.setWidth(popupWidth);
        content.setX(popupWidth / 2);
    } else {
        popupHeight = 0;
        popupWidth = width - 100;
        content.setHeight(popupHeight);
        content.setWidth(popupWidth);
        content.setX(50);
    }

    this.setHeight(height);
    this.setWidth(width);
    // Setzen eines neuen KeyDown Listener um Back Keys abzufangen. So wird
    // nur das Popups disposed.
    this.addListener(new InputListener() {

        @Override
        public boolean keyDown(final InputEvent event, final int keycode) {
            if ((keycode == Keys.ESCAPE) || (keycode == Keys.BACK)) {
                Gdx.app.log("Popup", "Back Key Detected");
                getOverlay().disposePopup();
                return true;
            }
            return false;
        }

    });

    createBackgroundImage();
    createContentGroup();
    super.addActor(content);
    fadeIn();
}
项目:HAW-SE2-projecthorse    文件:SettingsImpl.java   
/**
 * Wenn Sich die Orientation gedreht hat ändert sich ändert sich auch die
 * Breite.
 * 
 * @return Breite
 */
@Override
public int getVirtualScreenWidth() {
    if (GameManagerFactory.getInstance().getPlatform().getOrientation() == Orientation.Portrait) {
        return VIRTUALWIDTH;
    } else {
        return VIRTUALHIGHT;
    }

}
项目:HAW-SE2-projecthorse    文件:SettingsImpl.java   
/**
 * Wenn Sich die Orientation gedreht hat ändert sich ändert sich auch die
 * Höhe.
 * 
 * @return Höhe
 */
@Override
public int getVirtualScreenHeight() {
    if (GameManagerFactory.getInstance().getPlatform().getOrientation() == Orientation.Portrait) {
        return VIRTUALHIGHT;
    } else {
        return VIRTUALWIDTH;
    }
}
项目:gdx.automation    文件:JsonInputRecordReader.java   
private StaticProperties readStaticValues(StaticProperties values) {
    JsonValue json = reader.parse(staticPropertiesFile.reader());
    values.accelerometerAvailable = json
            .getBoolean("accelerometerAvailable");
    values.compassAvailable = json.getBoolean("compassAvailable");
    values.hasMultitouch = json.getBoolean("hasMultitouch");
    values.keyboardAvailable = json.getBoolean("keyboardAvailable");
    values.nativeOrientation = Orientation.valueOf((json
            .getString("nativeOrientation")));
    values.onscreenKeyboard = json.getBoolean("onscreenKeyboard");
    values.vibrator = json.getBoolean("vibrator");
    return values;
}
项目:gdx.automation    文件:JsonInputRecordReader.java   
@Override
public void visitOrientation(SyncProperty.Orientation orientation) {
    orientation.azimuth = json.getFloat("azimuth");
    orientation.orientation = json.getInt("orientation");
    orientation.pitch = json.getFloat("pitch");
    orientation.roll = json.getFloat("roll");
    JsonValue matrixJson = json.get("rotationMatrix");
    float[] matrix = new float[16];
    int i = 0;
    for (JsonValue value : matrixJson) {
        matrix[i] = value.asFloat();
        i++;
    }
    orientation.rotationMatrix = matrix;
}
项目:noiz2-gdx    文件:StarsLayer.java   
/**
 * Build view elements.
 * 
 */
private void buildElements()
{
    // ---------------------------------------------------------------
    // Background.
    // ---------------------------------------------------------------
    backGroundSprite = new BackgroundSprite(background, this.getWidth(), this.getHeight(), BACKGROUND_FRAME_DURATION, Orientation.Portrait, -1);
}
项目:ingress-indonesia-dev    文件:AndroidInput.java   
public AndroidInput(AndroidApplication paramAndroidApplication, View paramView, AndroidApplicationConfiguration paramAndroidApplicationConfiguration)
{
  paramView.setOnKeyListener(this);
  paramView.setOnTouchListener(this);
  paramView.setFocusable(true);
  paramView.setFocusableInTouchMode(true);
  paramView.requestFocus();
  paramView.requestFocusFromTouch();
  this.config = paramAndroidApplicationConfiguration;
  this.onscreenKeyboard = new AndroidOnscreenKeyboard(paramAndroidApplication, new Handler(), this);
  while (i < this.realId.length)
  {
    this.realId[i] = -1;
    i++;
  }
  this.handle = new Handler();
  this.app = paramAndroidApplication;
  this.sleepTime = paramAndroidApplicationConfiguration.touchSleepTime;
  if (Integer.parseInt(Build.VERSION.SDK) >= 5);
  for (this.touchHandler = new AndroidMultiTouchHandler(); ; this.touchHandler = new AndroidSingleTouchHandler())
  {
    this.hasMultitouch = this.touchHandler.supportsMultitouch(this.app);
    this.vibrator = ((Vibrator)paramAndroidApplication.getSystemService("vibrator"));
    int j = getRotation();
    Graphics.DisplayMode localDisplayMode = this.app.graphics.getDesktopDisplayMode();
    if (((j == 0) || (j == 180)) && ((localDisplayMode.width < localDisplayMode.height) && (((j != 90) && (j != 270)) || (localDisplayMode.width > localDisplayMode.height))))
      break;
    this.nativeOrientation = Input.Orientation.Landscape;
    return;
  }
  this.nativeOrientation = Input.Orientation.Portrait;
}
项目:HAW-SE2-projecthorse    文件:AndroidPlatform.java   
@Override
public Orientation getOrientation() {
    return active;
}
项目:HAW-SE2-projecthorse    文件:DesktopLauncher.java   
@Override
public Orientation getOrientation() {
    return active;
}
项目:HAW-SE2-projecthorse    文件:DefaultPlatform.java   
@Override
public void setOrientation(final Orientation orientation) {
    Gdx.app.log("Platform", "Diese Platform unterstützt diese setOrientation nicht");

}
项目:HAW-SE2-projecthorse    文件:DefaultPlatform.java   
@Override
public Orientation getOrientation() {
    return Orientation.Portrait;
}
项目:HAW-SE2-projecthorse    文件:Parcours.java   
/**
 * Konstruktor.
 */
public Parcours() {
    super(Orientation.Landscape);
    gameOperator = new GameOperator(new Stage(this.getViewport(), this.getSpriteBatch()), this.getViewport(),
            this.width, this.height, chest, this.audioManager, this.overlay);
}
项目:HAW-SE2-projecthorse    文件:Level.java   
/**
 * Constructor.
 */
public Level() {
    this(Orientation.Portrait);
}
项目:gdx.automation    文件:InputProperty.java   
void visitOrientation(
com.badlogic.gdx.automation.recorder.InputProperty.SyncProperty.Orientation orientation);
项目:Secludedness    文件:InputManager.java   
public void pollPlayerInput(float delta, Level level, Player player) {
    int xPosition = player.getPositionX();
    int yPosition = player.getPositionY();

    if ((Gdx.app.getType() == ApplicationType.Android) && (Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer))) {
        float accelX = Gdx.input.getAccelerometerX();
        float accelY = Gdx.input.getAccelerometerY();

        // Game is in landscape, so rotate axes when default orientation is portrait
        if (Gdx.input.getNativeOrientation() == Orientation.Portrait) {
            accelX = Gdx.input.getAccelerometerY();
            accelY = Gdx.input.getAccelerometerX();
        }

        float sensibility = 4.0f;
        if (Math.abs(accelX) <= 1.0f && Math.abs(accelY) <= 1.0f) {
            mAccelerometerReadyForPolling = true;
            return;
        }

        if (mAccelerometerReadyForPolling) {
            if (accelX > sensibility) {
                xPosition += 64;
                mAccelerometerReadyForPolling = false;
            } else if (accelX < -sensibility) {
                xPosition -= 64;
                mAccelerometerReadyForPolling = false;
            } else if (accelY > sensibility) {
                yPosition -= 64;
                mAccelerometerReadyForPolling = false;
            } else if (accelY < -sensibility) {
                yPosition += 64;
                mAccelerometerReadyForPolling = false;
            }
        }
    } else {
        if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
            xPosition += 64;
        } else if (Gdx.input.isKeyPressed(Keys.LEFT)) {
            xPosition -= 64;
        } else if (Gdx.input.isKeyPressed(Keys.UP)) {
            yPosition += 64;
        } else if (Gdx.input.isKeyPressed(Keys.DOWN)) {
            yPosition -= 64;
        }
    }

    handlePlayer(xPosition, yPosition);
}
项目:noiz2-gdx    文件:BackgroundSprite.java   
/**
 * Create scrolling background sprite.
 * 
 * @param texture
 *            The texture to scroll.
 * @param width
 *            Texture width.
 * @param height
 *            Texture height.
 * @param frameDuration
 *            Frame duration seconds.
 * @param orientation
 *            Portrait==vertical, Landscape=horizontal.
 * @param direction
 *            Direction of scroll 1 or -1.
 */
public BackgroundSprite(Texture texture, float width, float height, float frameDuration, Orientation orientation, int direction)
{
    super(texture, (int)width, (int)height);

    this.frameDuration = frameDuration;
    this.orientation = orientation;
    this.direction = direction;

    // Do this once so we don't have to do it repeatedly.
    this.frameDurationFactor = 1.0f / frameDuration;

    scrollTimer = 0.0f;

    texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
}
项目:ingress-indonesia-dev    文件:AndroidInput$SensorListener.java   
AndroidInput$SensorListener(AndroidInput paramAndroidInput, Input.Orientation paramOrientation, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2)
{
  this.accelerometerValues = paramArrayOfFloat1;
  this.magneticFieldValues = paramArrayOfFloat2;
  this.nativeOrientation = paramOrientation;
}
项目:ingress-indonesia-dev    文件:AndroidInput.java   
public final Input.Orientation getNativeOrientation()
{
  return this.nativeOrientation;
}
项目:ingress-indonesia-dev    文件:RemoteInput.java   
public Input.Orientation getNativeOrientation()
{
  return Input.Orientation.Landscape;
}
项目:HAW-SE2-projecthorse    文件:Platform.java   
/**
 * Setzt die Orientation. Portrait oder Landscape. (Vor allem für Android
 * wichtig)
 * 
 * @param orientation
 *            {@link Orientation}
 */
public void setOrientation(Orientation orientation);
项目:HAW-SE2-projecthorse    文件:Platform.java   
/**
 * Liefert die {@link Orientation}.
 * 
 * @return {@link Orientation}
 */
public Orientation getOrientation();