graphics
Class GraphicsFacade

java.lang.Object
  extended by graphics.GraphicsFacade

public class GraphicsFacade
extends Object

Class interfacing to the Core package. Contains the high level methods of the Graphics package.

Author:
Terje Øfsdahl

Field Summary
private  AudioSample attentionSound
           
private  GameMode currentGameMode
           
private  int currentModeActivated
           
private  String lectureCode
           
private  LectureGame lega
           
private  ArrayList<String> loggedInUsers
           
(package private)  ArrayList<FallingText> loginQueue
           
private  QuestionGraphics questionGraphics
           
private  Renderer renderer
           
private  int screenState
           
 
Constructor Summary
GraphicsFacade(boolean fullscreen, Dimension dimension, LectureGame lega)
          Instantiates variables, mousehandler, keyboardhandler and the OpenGL graphics.
 
Method Summary
 void currentModeActivated(int mode)
          Updates the state of the current Mode.
 int getGameMode()
           
 String getLectureCode()
           
 ArrayList<String> getLoggedInUsers()
           
 ArrayList<FallingText> getLoginQueue()
          Returns the representation of names to be displayed in the welcome message.
 ClientNetworkThread getNetworkConnection()
           
 QuestionGraphics getQuestionGraphics()
           
 Renderer getRenderer()
           
 int getScreenState()
           
 void netSend(String string)
          Sends the specified string to the Server.
 void newQuestion(String question, ArrayList<String> alternatives, int timelimit, int correctAlternativeIndex, int controlNumber)
          Called whenever a new quesiton is received.
 void returnGameResults(Respondent[] respondents)
          Routs the final high score list to the renderer for graphical processing.
 void returnResults(Respondent[] respondents)
          Routs the result to the renderer instance for graphical processing.
 void returnRoundResults(Respondent[] respondents)
          Routs the round result to the Server.renderer instance for graphical processing.
 void setLectureCode(String lectureCode)
           
 void setLoggedInUsers(ArrayList<String> loggedInUsers)
           
 void setLoginQueue(ArrayList<FallingText> loginQueue)
           
 void setQuestionGraphics(QuestionGraphics questionGraphics)
           
 void setScreenState(int screenState)
          Called whenever the state of the program is changed in order for the Core package to know which state the program is in.
 void userLoggedIn(String userName)
          Called whenever a user logs in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loggedInUsers

private ArrayList<String> loggedInUsers

loginQueue

ArrayList<FallingText> loginQueue

screenState

private int screenState

questionGraphics

private QuestionGraphics questionGraphics

lectureCode

private String lectureCode

renderer

private Renderer renderer

currentModeActivated

private int currentModeActivated

lega

private LectureGame lega

attentionSound

private AudioSample attentionSound

currentGameMode

private GameMode currentGameMode
Constructor Detail

GraphicsFacade

public GraphicsFacade(boolean fullscreen,
                      Dimension dimension,
                      LectureGame lega)
Instantiates variables, mousehandler, keyboardhandler and the OpenGL graphics.

Parameters:
fullscreen - Fullscreen or windowed version.
dimension - Preferred resolution of the window/fullscreen.
lega - The LectureGame object.
Method Detail

userLoggedIn

public void userLoggedIn(String userName)
Called whenever a user logs in. This is only used to display a welcome message on the screen. The actual model of respondents are kept in other variables and updated in other methods.

Parameters:
userName -

newQuestion

public void newQuestion(String question,
                        ArrayList<String> alternatives,
                        int timelimit,
                        int correctAlternativeIndex,
                        int controlNumber)
Called whenever a new quesiton is received. The mtehod sleeps Constants.DELAY_FOR_MOBILE_SYNC before updating the question to compromise for slower GPRS/3G links, than the wired/WIFI connection of this client.

Parameters:
question - The actual question string
alternatives - An array of alternatives as Strings
timelimit - how many seconds the students will have to answer the question
correctAlternativeIndex - The index of the correct alternative
controlNumber - an optional number for game specific processing. Might be the time of reception of the answers for future implemntation, or the summarized score.

getGameMode

public int getGameMode()

getQuestionGraphics

public QuestionGraphics getQuestionGraphics()

setQuestionGraphics

public void setQuestionGraphics(QuestionGraphics questionGraphics)

getScreenState

public int getScreenState()

setScreenState

public void setScreenState(int screenState)
Called whenever the state of the program is changed in order for the Core package to know which state the program is in.

Parameters:
screenState -

getLoginQueue

public ArrayList<FallingText> getLoginQueue()
Returns the representation of names to be displayed in the welcome message.

Returns:

setLoginQueue

public void setLoginQueue(ArrayList<FallingText> loginQueue)

getLectureCode

public String getLectureCode()

setLectureCode

public void setLectureCode(String lectureCode)

getLoggedInUsers

public ArrayList<String> getLoggedInUsers()

setLoggedInUsers

public void setLoggedInUsers(ArrayList<String> loggedInUsers)

getRenderer

public Renderer getRenderer()

returnResults

public void returnResults(Respondent[] respondents)
Routs the result to the renderer instance for graphical processing.

Parameters:
respondents -

currentModeActivated

public void currentModeActivated(int mode)
Updates the state of the current Mode.

Parameters:
mode -

getNetworkConnection

public ClientNetworkThread getNetworkConnection()

netSend

public void netSend(String string)
Sends the specified string to the Server.

Parameters:
string -

returnRoundResults

public void returnRoundResults(Respondent[] respondents)
Routs the round result to the Server.renderer instance for graphical processing.

Parameters:
respondents -

returnGameResults

public void returnGameResults(Respondent[] respondents)
Routs the final high score list to the renderer for graphical processing.

Parameters:
respondents -