Class ServerRenderer
java.lang.Object
za.co.wethinkcode.robots.server.rendering.ServerRenderer
This class encapsulates all rendering behavior on the server side
Most methods contained in this class are void methods that print statements to render the TUI
All of these are designed to be pure render methods, causing no state mutations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumNested Enum of ansi escape characters to make rendering more discoverable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconnectToServerTicket(WorldConfig config, String ipAddress) Renders the connect to server ticket display based on an IP address invalid input: '&' configstatic voiddisplayMazeAsIBM437(Maze maze) Take in a maze and print it in IBM437 formatstatic voidPrompt message for a Server Command to be enteredstatic StringgetRobotSymbol(Robot robot) static voidlogWorldCreation(World world) Log the specs of a world when it is created, printing out its specifications, as well as a picture to the server admin consolestatic voidImmediately renders the copy for a new robot connection being received.static voidprintWorld(World world) static voidrenderAnInternalDebugMessage(com.google.gson.JsonObject obj) Overload of internal Debug Message to take in a JSON objectstatic voidrenderAnInternalDebugMessage(String message) Take in a debug message that does not break the program but the server operator should be aware ofstatic voidstatic voidrenderAnInternalErrorMessage(String message) Take in an error that does not break the program but the server operator should be aware ofstatic voidrenderMessage(String message) Take in a message render it to the screenstatic voidrenderMessage(String message, ServerRenderer.Colour colour) Take in a message and render it in the given colour
-
Constructor Details
-
ServerRenderer
public ServerRenderer()
-
-
Method Details
-
displayMazeAsIBM437
Take in a maze and print it in IBM437 formatPlease note that this internally utilizes the
Maze.numbersConstructorinternally, and is subject to potential depreciation
- Parameters:
maze- the maze being rendered
-
connectToServerTicket
Renders the connect to server ticket display based on an IP address invalid input: '&' config- Parameters:
config- the world config being referencedipAddress- the ip address the server is hosted on
-
newRobotConnectionReceivedCopy
public static void newRobotConnectionReceivedCopy()Immediately renders the copy for a new robot connection being received. -
logWorldCreation
Log the specs of a world when it is created, printing out its specifications, as well as a picture to the server admin console- Parameters:
world- the world being rendered
-
renderAnInternalDebugMessage
Take in a debug message that does not break the program but the server operator should be aware of- Parameters:
message- the message being rendered
-
renderAnInternalDebugMessage
public static void renderAnInternalDebugMessage(com.google.gson.JsonObject obj) Overload of internal Debug Message to take in a JSON object- Parameters:
obj- the JSON being rendered.
-
renderAnInternalErrorMessage
Take in an error that does not break the program but the server operator should be aware of- Parameters:
message- the message being rendered
-
renderAnInternalErrorMessage
-
renderMessage
Take in a message and render it in the given colour- Parameters:
message- the message being renderedcolour- the colour the message will have
-
renderMessage
Take in a message render it to the screen- Parameters:
message- the message being rendered
-
printWorld
-
enterServerCommand
public static void enterServerCommand()Prompt message for a Server Command to be entered -
getRobotSymbol
-