Android Open Source - wannabe Camera






From Project

Back to project page wannabe.

License

The source code is released under:

MIT License

If you think the Android project wannabe listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

// Copyright 2013 Patrick Forhan.
package wannabe;
/*from   w w w  .  j a v  a2  s .co  m*/
/** Movable view of the playfield. */
public class Camera {
  /** The position of this camera in the voxel space. */
  public final Position position;
  /** This position of this camera in the UI (pixel) space.  The size value is ignored. */
  public final Rendered uiPosition = new Rendered();
  private final Position translated = new Position();

  public Camera(int x, int y, int z) {
    position = new Position(x, y, z);
  }

  /**
   * Translate a position based on the camera's position.  Note: the returned reference is
   * reused on every call to translate().
   */
  public Position translate(Position toTranslate) {
    translated.x = toTranslate.x - position.x;
    translated.y = toTranslate.y - position.y;
    translated.z = toTranslate.z - position.z;
    return translated;
  }
}




Java Source Code List

android.util.ArrayUtils.java
android.util.SparseArray.java
android.util.SparseIntArray.java
wannabe.Camera.java
wannabe.Position.java
wannabe.Rendered.java
wannabe.UI.java
wannabe.Voxel.java
wannabe.android.MainActivity.java
wannabe.grid.FixedGrid.java
wannabe.grid.Grid.java
wannabe.grid.SimpleGrid.java
wannabe.projection.Flat.java
wannabe.projection.Isometric.java
wannabe.projection.Projection.java
wannabe.projection.Projections.java
wannabe.projection.PseudoPerspective.java
wannabe.swing.SettingsPanel.java
wannabe.swing.SwingWannabe.java
wannabe.swing.WannabePanel.java
wannabe.util.SampleGrids.java
wannabe.util.UIs.java