summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/ui/Bg.java
blob: 081ff93da33eea9f646eedf15021c28b11326f3d (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
33
34
package ch.asynk.rustanddust.ui;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Bg extends Widget
{
    private static float SCALE = 1.0f;
    private TextureRegion region;

    public Bg(TextureRegion region)
    {
        super();
        this.region = region;
        rect.set(0, 0, region.getRegionWidth() * SCALE, region.getRegionHeight() * SCALE);
    }

    public static void setScale(float scale)
    {
        SCALE = scale;
    }

    @Override
    public void dispose()
    {
    }

    @Override
    public void draw(Batch batch)
    {
        if (!visible) return;
        batch.draw(region, rect.x, rect.y, rect.width, rect.height);
    }
}