blob: 1d751a612dfc3a04f4952d97e4b144eb5c1053f5 (
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
41
42
43
|
package ch.asynk.tankontank.game;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.GridPoint2;
public interface HexMap
{
// libgdx
public float getWidth();
public float getHeight();
// game
public GridPoint2 getHexAt(GridPoint2 hex, float x, float y);
public Pawn getTopPawnAt(GridPoint2 hex);
public Vector2 getHexCenterAt(GridPoint2 hex);
public Vector2 getPawnPosAt(Pawn pawn, GridPoint2 hex);
public void movePawnTo(Pawn pawn, Vector3 coords);
public void setPawnAt(Pawn pawn, int col, int row, Hex.Orientation o);
public void movePawnTo(Pawn pawn, int col, int row, Hex.Orientation o);
public class Config
{
public int cols;
public int rows;
public int x0 = 83; // map offset
public int y0 = 182; // map offset
public int h = 110; // hex side
public float dh = 53.6f; // hex top should be h/2
public int w = 189; // hex width
public int dw = 94; // half hex should be w/2
public float H = h + dh; // total height
public float slope = (dh / (float) dw);
}
}
|