summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-01-21 14:08:24 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2020-01-21 14:08:24 +0100
commitd96cbcff5251ec3d4a92e45e701af9195032c517 (patch)
treeb4898b1387eb65a584de18f0350eec8705561e96
parent3a153fe86fcd3ae224b7c6ddba1780eeed89ec8a (diff)
downloadgdx-boardgame-d96cbcff5251ec3d4a92e45e701af9195032c517.zip
gdx-boardgame-d96cbcff5251ec3d4a92e45e701af9195032c517.tar.gz
Orientation : add Orientation opposite()
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Orientation.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Orientation.java b/core/src/ch/asynk/gdx/boardgame/Orientation.java
index 677c979..e5c906b 100644
--- a/core/src/ch/asynk/gdx/boardgame/Orientation.java
+++ b/core/src/ch/asynk/gdx/boardgame/Orientation.java
@@ -62,6 +62,12 @@ public enum Orientation
return (o.r == -1) ? o.right() : o;
}
+ public Orientation opposite()
+ {
+ if (s <= NW.s) return fromS(this.s << 4);
+ return fromS(this.s >> 4);
+ }
+
public static Orientation fromS(int s)
{
if (s == E.s) return E;