From d96cbcff5251ec3d4a92e45e701af9195032c517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 21 Jan 2020 14:08:24 +0100 Subject: Orientation : add Orientation opposite() --- core/src/ch/asynk/gdx/boardgame/Orientation.java | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit v1.1-2-g2b99