Skip to content
Snippets Groups Projects
Commit 5f09b298 authored by zalavari's avatar zalavari
Browse files

new function added which convert string to direction

parent b8e9e1e8
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,16 @@ public enum Direction { ...@@ -30,6 +30,16 @@ public enum Direction {
default : return DOWN; default : return DOWN;
} }
} }
public static Direction fromString(String dir)
{
switch (dir)
{
case "left" : return LEFT;
case "up" : return UP;
case "right" : return RIGHT;
default : return DOWN;
}
}
public Direction opposite() public Direction opposite()
{ {
switch (this) switch (this)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment