I use Libgdx and Tween engine. I get a weird problem when registering accessor like this.
EDIT: It seems that my Eclipse cant even find SpriteAccessor();. I installed Libgdx and Tween with the libGdx GUI installer. any advice how to fix this?
this class implements Screen
@Override
public void show() {
splashTexture = new Texture(Gdx.files.internal("img/splash.png"));
splash = new Sprite(splashTexture);
splash.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch = new SpriteBatch();
tweenManager = new TweenManager();
Tween.registerAccessor(Sprite.class, new SpriteAccessor()); //Here the SpriteAccessor is underlined
splashBgm = Gdx.audio.newMusic(Gdx.files.internal("sounds/bgm.mp3"));
splashBgm.setVolume(.2f);
splashBgm.setLooping(true);
splashBgm.play();
}
And here is my ScreenAccessor class that implements TweenAccessor
@Override
public int getValues(Sprite target, int tweenType, float[] returnValues) {
switch(tweenType){
case ALPHA:
returnValues[0] = target.getColor().a;
return 1;
default:
assert false;
return -1;
}
}
@Override
public void setValues(Sprite target, int tweenType, float[] newValues) {
switch(tweenType){
case ALPHA:
target.setColor(target.getColor().r, target.getColor().g, target.getColor().b, newValues[0]);
break;
default:
assert false;
}
}
Thank you.