GUI - Pihl17/PCSS2018---TheRealGroup1-Client GitHub Wiki

GUI class

extends Application
implements GUIConstants

Methods:

void start(Stage stage) Overriden method from Application class. Sets up the mainScene variable and adds it to the stage before calling it's show method. An object of the IThread class is then started. Throws Exception.
GridPane ChatPane() Sets up the pane for the chatlog, chatField and sendButton, returning it as a GridPane.
void SetUpChatlog() Adds empty Labels into the chat based on the CHAT_MAX_LOGS constant found in GUIConstants.
TextField ChatField() Sets up and returns the chatField variable.
Button StartButton() Sets up and returns the button for starting a game.
Button SendButton() Sets up and returns the button for sending chat messages.
void SendToChat(TextField field) Sends what is written in the TextField argument as a String to the server, unless it's empty or starts with "/avatar ".
void AddToChat(Label... labels) Adds the labels to the chat, while removing old logs.
void SetChat(Label... labels) Calls the chatlog.getChildren().setAll() with labels as the argument.
GridPane CreateGrid() Sets up and returns the gridPane. This method also sets up the event filter that awaits and reacts on mouse clicks.
void setLocation(int rows, int columns, GridPane gridPane, int x, int y, Label avatar) Moves the specified avatar to the x and y coordinates on the grid, if the avatar's not there, then will a new one be made at the location.
void movePlayer(String output) Changes or adds an avatar based on the position. Awaits a String of the structure "id x y a", with id being the user's id, x and y being the coordinates, and a being an int that represents the avatar. If no player with the id exists, then will a new one be constructed with it.