|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectfang.Client
public class Client
The Client traps input from the user and sends it to the Server asynchronously. It also receives regular updates from the Server for the mouse and keyboard inputs and the current time, then updates and refreshes the screen.
| Field Summary | |
|---|---|
Keyboard[] |
keyboard
all of the keyboards of the computers connected |
Object[] |
message
used to receive general messages from the Server |
Mouse[] |
mouse
all of the mouses of the computers connected |
| Constructor Summary | |
|---|---|
Client(String machine,
String game,
String session,
int players,
GameLoop frameAdvancer)
sets the domain, game and session name and connects to the server. |
|
| Method Summary | |
|---|---|
void |
clearInput()
|
void |
connect()
Connects to the server then goes into an infinite loop sending and receiving consistency information from and to the server. |
void |
disconnect()
disconnects and terminates sending and receiving informations to and from the server |
static String |
getHostname()
gets the name of the localhost on the network |
int |
getID()
gets the id of the current client. |
static String[] |
getWaitingSessions(String machine,
String game)
|
boolean |
isConnected()
determines if this Client has open communications to the Server |
boolean |
isPaused()
determines if the game is currently advancing |
void |
pauseToggle()
if the game was paused, this method will set it running again. |
void |
setGameLoop(GameLoop frameAdvancer)
sets the Client's GameLoop. |
void |
setLocalKeyboard(Keyboard localKeyboard)
sets the Client's local Keyboard. |
void |
setLocalMessage(Object localMessage)
clients can send a generic message to all of the connected clients via the server. |
void |
setLocalMouse(Mouse localMouse)
sets the Client's local Mouse. |
void |
update(Observable arg0,
Object arg1)
this method is called when there is new information to send to the server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Keyboard[] keyboard
public Mouse[] mouse
public Object[] message
| Constructor Detail |
|---|
public Client(String machine,
String game,
String session,
int players,
GameLoop frameAdvancer)
machine - the domain of the servergame - the name of the gamesession - the name of the current sessionplayers - the number of players to wait for
(only used for the first person starting the session)frameAdvancer - the model/view to update| Method Detail |
|---|
public static String[] getWaitingSessions(String machine,
String game)
public void setLocalMessage(Object localMessage)
localMessage - The localMessage to set.public void setGameLoop(GameLoop frameAdvancer)
frameAdvancer - The frameAdvancer to set.public void setLocalKeyboard(Keyboard localKeyboard)
localKeyboard - The localKeyboard to set.public void setLocalMouse(Mouse localMouse)
localMouse - The localMouse to set.public boolean isConnected()
public static String getHostname()
public void clearInput()
public void pauseToggle()
public void connect()
Runnable.run()public void disconnect()
public boolean isPaused()
public int getID()
public void update(Observable arg0,
Object arg1)
update in interface Observerarg0 - not usedarg1 - not usedObserver.update(java.util.Observable, java.lang.Object)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||