Android Open Source - TreeFrogEngine View






From Project

Back to project page TreeFrogEngine.

License

The source code is released under:

MIT License

If you think the Android project TreeFrogEngine 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

package com.discretesoftworks.framework;
/*from   www  .  java2 s  .  com*/
// Controls camera position and possible movement
public class View extends GriddedObject{
  
  private float newX, newY, newZ;
  private float centerX, centerY, centerZ;
  
  private static final float baseZ = 5.5f;
  private float speed;
  
  public View(float x, float y, float z, float centerX, float centerY, float centerZ){
    super(x,y,z);
    speed = 16;
    
    this.centerX = centerX;
    this.centerY = centerY;
    this.centerZ = centerZ;
    
  }
  
  public float getCenterX(){
    return centerX;
  }
  
  public float getCenterY(){
    return centerY;
  }
  
  public float getCenterZ(){
    return centerZ;
  }
  
  public void setCenter(float cX, float cY, float cZ){
    this.centerX = cX;
    this.centerY = cY;
    this.centerZ = cZ;
  }
  
  public void changeCenterX(float dcX){
    centerX += dcX;
  }
  
  public void changeCenterY(float dcY){
    centerY += dcY;
  }
  
  public void changeCenterZ(float dcZ){
    centerZ += dcZ;
  }
  
  public float getBaseZ(){
    return baseZ;
  }
  
  public float getViewScale(){
    return getZ()/baseZ;
  }
  
  public void setNewX(float newX){
    this.newX = newX;
  }
  
  public void setNewY(float newY){
    this.newY = newY;
  }
  
  public void setNewZ(float newZ){
    this.newZ = newZ;
  }
  
  public float getNewX(){
    return newX;
  }
  
  public float getNewY(){
    return newY;
  }
  
  public float getNewZ(){
    return newZ;
  }
  
  public void setSpeed(float speed){
    this.speed = speed;
  }
  
  public float getSpeed(){
    return speed;
  }
  
  @Override
  public void setX(float x){
    super.setX(x);
    setNewX(x);
  }
  
  @Override
  public void setY(float y){
    super.setY(y);
    setNewY(y);
  }
  
  @Override
  public void setZ(float z){
    super.setZ(z);
    setNewZ(z);
  }
  
  public void update(float deltaTime){
    setX((newX+getX())/speed);
    setY((newY+getX())/speed);
    setZ((newZ+getZ())/speed);
  }
}




Java Source Code List

com.discretesoftworks.OUYAframework.OuyaGameController.java
com.discretesoftworks.OUYAframework.OuyaGame.java
com.discretesoftworks.TestGame.Floor.java
com.discretesoftworks.TestGame.Player.java
com.discretesoftworks.TestGame.Pointer.java
com.discretesoftworks.TestGame.TestController.java
com.discretesoftworks.TestGame.TestGame.java
com.discretesoftworks.framework.AndroidGame.java
com.discretesoftworks.framework.Assets.java
com.discretesoftworks.framework.Directional.java
com.discretesoftworks.framework.GameController.java
com.discretesoftworks.framework.GameFont.java
com.discretesoftworks.framework.GameObject.java
com.discretesoftworks.framework.GameRenderer.java
com.discretesoftworks.framework.GriddedObject.java
com.discretesoftworks.framework.ModelLoader.java
com.discretesoftworks.framework.MovingObject.java
com.discretesoftworks.framework.MyGLRenderer.java
com.discretesoftworks.framework.MyGLSurfaceView.java
com.discretesoftworks.framework.NumericalMatrix.java
com.discretesoftworks.framework.Pair.java
com.discretesoftworks.framework.Path.java
com.discretesoftworks.framework.Pool.java
com.discretesoftworks.framework.RaggedDictionary.java
com.discretesoftworks.framework.RenderModel.java
com.discretesoftworks.framework.Sprite.java
com.discretesoftworks.framework.Terrain.java
com.discretesoftworks.framework.TextDisplay.java
com.discretesoftworks.framework.TextHolder.java
com.discretesoftworks.framework.View.java
com.discretesoftworks.networking.NetworkGameController.java
com.discretesoftworks.networking.Writer.java