graphics
Class BarGraphics

java.lang.Object
  extended by graphics.BarGraphics

public class BarGraphics
extends Object

Represent a graphical bar used in the Measure Up Mode. After setting the start drawing point in the openGL context and instantiating a bar. The bar can be drawn.

Author:
Terje

Field Summary
private  float b
           
private  boolean barStopped
           
private  boolean blinkOn
           
private  float currentHeigth
           
private  String feedback
           
private  float feedBackAlpha
           
private  float flyHeigth
           
private  float g
           
private  float maxHeight
           
private  int pourcentageScore
           
private  AudioSample powerDownSound
           
private  AudioSample powerupSound
           
private  float r
           
private  boolean revealAnswer
           
private  float stopHeight
           
private  float width
           
 
Constructor Summary
BarGraphics(float r, float g, float b, double stopHeight)
          Initiates a new bar.
 
Method Summary
 float getCurrentHeigth()
           
 int getDrawnScore()
           
 String getFeedback()
           
 float getFeedBackAlpha()
           
 float getFlyHeigth()
           
 float getMaxHeigth()
           
 float getStopHeight()
           
 float getWidth()
           
 boolean isBarStopped()
           
 boolean isRevealAnswer()
           
 void playSound()
          Play an appropriate sound relating to the score.
 void renderBar(javax.media.opengl.GLAutoDrawable glDrawable)
          Performs the acutal drawing of the bar on the OpenGL canvas.
 void reset()
          resets the local counters of the bar.
 void setBarStopped(boolean barStopped)
           
 void setCurrentHeigth(float currentHeigth)
          Used to increase the hight of the bar in real time as the bar grows.
 void setFeedback(String feedback)
           
 void setFeedBackAlpha(float feedBackAlpha)
           
 void setMaxHeigth(float maxHeight)
           
 void setRevealAnswer(boolean revealAnswer)
           
 void setStopHeight(int pourcentageScore)
           
 void setWidth(float width)
           
 void updateState()
          Called to for each frame to perform the actual grwoing of the bar as well as the blinking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxHeight

private float maxHeight

currentHeigth

private float currentHeigth

width

private float width

stopHeight

private float stopHeight

barStopped

private boolean barStopped

flyHeigth

private float flyHeigth

feedback

private String feedback

feedBackAlpha

private float feedBackAlpha

r

private float r

g

private float g

b

private float b

revealAnswer

private boolean revealAnswer

blinkOn

private boolean blinkOn

powerupSound

private AudioSample powerupSound

powerDownSound

private AudioSample powerDownSound

pourcentageScore

private int pourcentageScore
Constructor Detail

BarGraphics

public BarGraphics(float r,
                   float g,
                   float b,
                   double stopHeight)
Initiates a new bar.

Parameters:
r - Amount of red.
g - Amount of g.
b - AMount of blue
stopHeight - heigth of the bar when it is to stop growing.
Method Detail

isRevealAnswer

public boolean isRevealAnswer()
Returns:
wether or not the correct answer is ready to be revealed.

renderBar

public void renderBar(javax.media.opengl.GLAutoDrawable glDrawable)
Performs the acutal drawing of the bar on the OpenGL canvas.

Parameters:
glDrawable -

updateState

public void updateState()
Called to for each frame to perform the actual grwoing of the bar as well as the blinking.


reset

public void reset()
resets the local counters of the bar.


getCurrentHeigth

public float getCurrentHeigth()
Returns:
the current height of the drawn bar.

setCurrentHeigth

public void setCurrentHeigth(float currentHeigth)
Used to increase the hight of the bar in real time as the bar grows.

Parameters:
currentHeigth - the wanted heigth of the bar.

getMaxHeigth

public float getMaxHeigth()

setMaxHeigth

public void setMaxHeigth(float maxHeight)

getWidth

public float getWidth()

getFeedback

public String getFeedback()

setFeedback

public void setFeedback(String feedback)

setWidth

public void setWidth(float width)

getStopHeight

public float getStopHeight()

setStopHeight

public void setStopHeight(int pourcentageScore)

getDrawnScore

public int getDrawnScore()

isBarStopped

public boolean isBarStopped()

setBarStopped

public void setBarStopped(boolean barStopped)

getFlyHeigth

public float getFlyHeigth()

getFeedBackAlpha

public float getFeedBackAlpha()

setFeedBackAlpha

public void setFeedBackAlpha(float feedBackAlpha)

setRevealAnswer

public void setRevealAnswer(boolean revealAnswer)

playSound

public void playSound()
Play an appropriate sound relating to the score.