Android Open Source - proteus-sidescroller Actor Accessor






From Project

Back to project page proteus-sidescroller.

License

The source code is released under:

GNU General Public License

If you think the Android project proteus-sidescroller 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.bartholomew.proteus.tween;
//from w ww  .j  a va 2  s  . c o m
import com.badlogic.gdx.scenes.scene2d.Actor;
import aurelienribon.tweenengine.TweenAccessor;

public class ActorAccessor implements TweenAccessor<Actor> {

  public static final int Y = 0, RGB = 1, ALPHA = 2;
  
  @Override
  public int getValues(Actor target, int tweenType, float[] returnValues) {
    switch (tweenType){
    case Y:
      returnValues[0] = target.getY();
    case RGB:
      returnValues[0] = target.getColor().r;
      returnValues[1] = target.getColor().g;
      returnValues[2] = target.getColor().b;
      return 1;
    case ALPHA:
      returnValues[0] = target.getColor().a;
      return 1;
    default:
      return -1; // Error, unknown tweenType
    }
    
  }

  @Override
  public void setValues(Actor target, int tweenType, float[] newValues) {
    switch (tweenType){
    case Y:
      target.setY(newValues[0]);
      break;
    case RGB:
      target.setColor(newValues[0], newValues[1], newValues[2], target.getColor().a);
      break;
    case ALPHA:
      target.setColor(target.getColor().r, target.getColor().g, target.getColor().b, newValues[0]);
      break;
    default:
      assert false;
    }
  }

}




Java Source Code List

com.bartholomew.proteus.GameWorld.java
com.bartholomew.proteus.InputController.java
com.bartholomew.proteus.MainActivity.java
com.bartholomew.proteus.MainMenu.java
com.bartholomew.proteus.Main.java
com.bartholomew.proteus.Proteus.java
com.bartholomew.proteus.Splash.java
com.bartholomew.proteus.client.GwtLauncher.java
com.bartholomew.proteus.tween.ActorAccessor.java
com.bartholomew.proteus.tween.SpriteAccessor.java