Example #1
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
Image::Image( OpenGLRenderer* renderer, UIElement* parent, Texture* image, const Vector2& size,
    Anchor anchor /* = BOTTOM_LEFT */, const Vector2& offset /* = Vector2::ZERO */, const float& zVal /* = 1.0f */ )
    : UIElement( renderer, parent )
    , m_image( image )
{
    m_zVal = zVal;
    m_anchor = anchor;
    m_offset = offset;
    m_size = size;

    Vector2 mins = CalculatePosition();

    m_bounds.m_mins = mins;
    m_bounds.m_maxs = mins + m_size;
    CalcVerts();
}
Example #2
0
//----------------------------------------------------------------------------
// OPENGL CAMERA FRUSTUM DRAWING ROUTINES
//----------------------------------------------------------------------------
void Camera::Display() const
{
  // CALC EIGHT CORNERS OF FRUSTUM (NEAR PTS AND FAR PTS)
  Vec3f V[8];
  CalcVerts(V);


  // DRAW THE FRUSTUM IN WIREFRAME
  glBegin(GL_LINE_LOOP);  // TOP FACE
    glVertex3fv(&(V[4].x)); glVertex3fv(&(V[5].x)); 
    glVertex3fv(&(V[1].x)); glVertex3fv(&(V[0].x));
  glEnd();
  glBegin(GL_LINE_LOOP);  // BOTTOM FACE
    glVertex3fv(&(V[3].x)); glVertex3fv(&(V[2].x));
    glVertex3fv(&(V[6].x)); glVertex3fv(&(V[7].x)); 
  glEnd();
  glBegin(GL_LINE_LOOP);  // LEFT FACE
    glVertex3fv(&(V[1].x)); glVertex3fv(&(V[5].x));
    glVertex3fv(&(V[6].x)); glVertex3fv(&(V[2].x)); 
  glEnd();
  glBegin(GL_LINE_LOOP);  // RIGHT FACE
    glVertex3fv(&(V[0].x)); glVertex3fv(&(V[3].x));
    glVertex3fv(&(V[7].x)); glVertex3fv(&(V[4].x)); 
  glEnd();
  glBegin(GL_LINE_LOOP);  // NEAR FACE
    glVertex3fv(&(V[1].x)); glVertex3fv(&(V[2].x));
    glVertex3fv(&(V[3].x)); glVertex3fv(&(V[0].x)); 
  glEnd();
  glBegin(GL_LINE_LOOP);  // FAR FACE
    glVertex3fv(&(V[4].x)); glVertex3fv(&(V[7].x));
    glVertex3fv(&(V[6].x)); glVertex3fv(&(V[5].x)); 
  glEnd();

  // DRAW PROJECTOR LINES FROM EYE TO CORNERS OF VIEWPLANE WINDOW
  glBegin(GL_LINES);
    glVertex3fv(&(Orig.x)); glVertex3fv(&(V[1].x));
    glVertex3fv(&(Orig.x)); glVertex3fv(&(V[2].x));
    glVertex3fv(&(Orig.x)); glVertex3fv(&(V[3].x));
    glVertex3fv(&(Orig.x)); glVertex3fv(&(V[0].x));
  glEnd();

}
Example #3
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
ProgressBar::ProgressBar( OpenGLRenderer* renderer, UIElement* parent, const IntRange& values, Font* font, const Vector2& size, const Rgba& backgroundColor, const Rgba& foregroundColor,
    Anchor anchor /* = BOTTOM_LEFT */, const Vector2& offset /* = Vector2::ZERO */, const float& zVal /* = 1.0f */, const Rgba& fontColor /* = Rgba() */ )
    : UIElement( renderer, parent )
    , m_fontColor( fontColor )
    , m_backgroundColor( backgroundColor )
    , m_foregroundColor( foregroundColor )
    , m_percentage( 1.0f )
    , m_values( values )
{
    m_zVal = zVal;
    m_anchor = anchor;
    m_offset = offset;
    m_size = size;

    Vector2 mins = CalculatePosition();

    m_bounds.m_mins = mins;
    m_bounds.m_maxs = mins + m_size;
    CalcVerts();

    m_textbox = new TextBox( renderer, this, font, 12, CENTER_CENTER, Vector2::ZERO, fontColor, "", zVal - 0.3f );
}