summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/loading/LoadingBar.java
blob: 5a6181a7747ff5b3ee896d66d5f75f1bfd7cd647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package ch.asynk.rustanddust.loading;

import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

public class LoadingBar extends Actor
{
    Animation animation;
    TextureRegion reg;
    float stateTime;

    public LoadingBar(Animation animation)
    {
        this.animation = animation;
        reg = animation.getKeyFrame(0);
    }

    @Override
    public void act(float delta)
    {
        stateTime += delta;
        reg = animation.getKeyFrame(stateTime);
    }

    @Override
    public void draw(Batch batch, float parentAlpha)
    {
        batch.draw(reg, getX(), getY());
    }
}