blob: 38728c090665c0877e90a8dcd6a0b350c7e868fc (
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
35
36
37
38
39
40
|
package ch.asynk.zproject;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Disposable;
public class Hud implements Disposable
{
private final Sprite hud;
public Hud(final Assets assets)
{
this.hud = new Sprite(assets.getTexture(assets.CORNER));
}
@Override public void dispose()
{
hud.getTexture().dispose();
}
public void draw(SpriteBatch batch, final Rectangle rect)
{
float right = rect.x + rect.width - hud.getWidth();
float top = rect.y + rect.height - hud.getHeight();
hud.setRotation(0);
hud.setPosition(rect.x, top);
hud.draw(batch);
hud.setRotation(90);
hud.setPosition(rect.x, rect.y);
hud.draw(batch);
hud.setRotation(180);
hud.setPosition(right, rect.y);
hud.draw(batch);
hud.setPosition(right, top);
hud.setRotation(270);
hud.draw(batch);
}
}
|