summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/loading/LoadingBar.java
blob: 2b1471306fb894edbf7dd264f8256dc54efdb13b (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.tankontank.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());
    }
}