Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rogue-savage-rats/src/mightypork/rogue/world/Sides.java

46 lines
1.1 KiB

package mightypork.rogue.world;
public class Sides {
//@formatter:off
public static final byte NW = (byte) 0b10000000;
public static final byte N = 0b01000000;
public static final byte NE = 0b00100000;
public static final byte E = 0b00010000;
public static final byte SE = 0b00001000;
public static final byte S = 0b00000100;
public static final byte SW = 0b00000010;
public static final byte W = 0b00000001;
public static final byte CARDINAL = N|S|E|W;
public static final byte DIAGONAL = NE|NW|SE|SW;
public static final byte NW_CORNER = W|NW|N;
public static final byte NE_CORNER = E|NE|N;
public static final byte SW_CORNER = W|SW|S;
public static final byte SE_CORNER = E|SE|S;
private final static Coord[] side = {
Coord.make(-1, -1),
Coord.make(0, -1),
Coord.make(1, -1),
Coord.make(1, 0),
Coord.make(1, 1),
Coord.make(0, 1),
Coord.make(-1, 1),
Coord.make(-1, 0)
};
//@formatter:on
public static Coord get(int i)
{
return side[i]; // FIXME Coord is mutable
}
public static byte bit(int i)
{
return (byte) (1 << (7 - i));
}
}