Beispiel #1
0
void ParamListGL::Render(int x, int y, bool shadow)
{
    beginWinCoords();
    start_x = x; start_y = y;

    for(std::vector<ParamBase *>::const_iterator p = m_params.begin(); p != m_params.end(); ++p)
    {
        if ((*p)->IsList())
        {
            ParamListGL *list = (ParamListGL *) (*p);
            list->Render(x+10, y);
            y += separation*list->GetSize();
        } 
        else 
        {
            if (p == m_current)
            {
                glColor3fv(text_col_selected);
            }
            else
            {
                glColor3fv(text_col_unselected);
            }

            if (shadow)
            {
                glPrintShadowed(x + text_x, y + font_h, (*p)->GetName()->c_str(), font, (p == m_current) ? text_col_selected : text_col_unselected);
                glPrintShadowed(x + value_x, y + font_h, (*p)->GetValueString().c_str(), font, (p == m_current) ? text_col_selected : text_col_unselected);
            }
            else 
            {
                glPrint(x + text_x, y + font_h, (*p)->GetName()->c_str(), font);
                glPrint(x + value_x, y + font_h, (*p)->GetValueString().c_str(), font);
            } 

            // glColor3fv((GLfloat *) &bar_col_outer);
            glBegin(GL_LINE_LOOP);
            glVertex2f((GLfloat)(x + bar_x)        , (GLfloat)(y + bar_offset));
            glVertex2f((GLfloat)(x + bar_x + bar_w), (GLfloat)(y + bar_offset));
            glVertex2f((GLfloat)(x + bar_x + bar_w), (GLfloat)(y + bar_offset + bar_h));
            glVertex2f((GLfloat)(x + bar_x)        , (GLfloat)(y + bar_offset + bar_h));
            glEnd();

            // glColor3fv((GLfloat *) &bar_col_inner);
            glRectf((GLfloat)(x + bar_x), (GLfloat)(y + bar_offset + bar_h), (GLfloat)(x + bar_x + (bar_w*(*p)->GetPercentage())), (GLfloat)(y + bar_offset));
            y += separation;
        }
    }

    endWinCoords();
}
Beispiel #2
0
void
ParamListGL::Render(int x, int y, bool shadow)
{
    beginWinCoords();

    m_start_x = x;
    m_start_y = y;

    for(std::vector<ParamBase *>::const_iterator p = m_params.begin(); p != m_params.end(); ++p) {
        if ((*p)->IsList()) {
            ParamListGL *list = (ParamListGL *) (*p);
            list->Render(x+10, y);
            y += m_separation*list->GetSize();

        } else {
            if (p == m_current)
                glColor3fv(&m_text_color_selected.r);
            else
                glColor3fv(&m_text_color_unselected.r);

            if (shadow) {
                glPrintShadowed(x + m_text_x, y + m_font_h, (*p)->GetName().c_str(), m_font, (p == m_current) ? &m_text_color_selected.r : &m_text_color_unselected.r);
                glPrintShadowed(x + m_value_x, y + m_font_h, (*p)->GetValueString().c_str(), m_font, (p == m_current) ? &m_text_color_selected.r : &m_text_color_unselected.r);
            } else {
                glPrint(x + m_text_x, y + m_font_h, (*p)->GetName().c_str(), m_font);
                glPrint(x + m_value_x, y + m_font_h, (*p)->GetValueString().c_str(), m_font);
            } 

            glColor3fv((GLfloat *) &m_bar_color_outer.r);
            glBegin(GL_LINE_LOOP);
            glVertex2f((GLfloat)(x + m_bar_x)          , (GLfloat)(y + m_bar_offset)          );
            glVertex2f((GLfloat)(x + m_bar_x + m_bar_w), (GLfloat)(y + m_bar_offset)          );
            glVertex2f((GLfloat)(x + m_bar_x + m_bar_w), (GLfloat)(y + m_bar_offset + m_bar_h));
            glVertex2f((GLfloat)(x + m_bar_x)          , (GLfloat)(y + m_bar_offset + m_bar_h));
            glEnd();

            glColor3fv((GLfloat *) &m_bar_color_inner.r);
            glRectf((GLfloat)(x + m_bar_x), (GLfloat)(y + m_bar_offset + m_bar_h), (GLfloat)(x + m_bar_x + ((m_bar_w-1)*(*p)->GetPercentage())), (GLfloat)(y + m_bar_offset + 1));

            y += m_separation;
        }

    }

    endWinCoords();
}